InStr Help Needed 
Author Message
 InStr Help Needed

I have a field that in some cases looks like this FBO JOHN M JONES.  I am
trying to write some code that goes throught a field and looks for "FBO ",
if it is present deletes everything before it and then appends it to the
fields FirstName, MiddleI, LastName.

Anyideas on where to start?

Thanks in Advance



Tue, 09 Dec 2003 22:50:02 GMT  
 InStr Help Needed


Quote:
> I have a field that in some cases looks like this FBO JOHN M JONES.  I am
> trying to write some code that goes throught a field and looks for "FBO ",
> if it is present deletes everything before it and then appends it to the
> fields FirstName, MiddleI, LastName.

I think that should do it:

Dim strFindMe As String
Dim strString As String
Dim ctl As Control
Dim intStart As Integer, intLenght As Integer

'string to look for
strFindMe = "FBO"

'cycling through all controls
For Each ctl In Me.Controls

    'only check Text and Combo boxes...
    If ctl.ControlType = acTextBox Or ctl.ControlType = acComboBox Then

        'looking for string
        If InStr(ctl.Value, strFindMe) > 0 Then

            intStart = InStr(ctl.Value, strFindMe) + Len(strFindMe)

            'cutting off everything on the left of it
            ctl.Value = Mid(ctl.Value, intStart)

        End If

    End If

Next



Tue, 09 Dec 2003 23:02:58 GMT  
 InStr Help Needed
Ray:

Thanks for the assistance.


Quote:


> > I have a field that in some cases looks like this FBO JOHN M JONES.  I
am
> > trying to write some code that goes throught a field and looks for "FBO
",
> > if it is present deletes everything before it and then appends it to the
> > fields FirstName, MiddleI, LastName.

> I think that should do it:

> Dim strFindMe As String
> Dim strString As String
> Dim ctl As Control
> Dim intStart As Integer, intLenght As Integer

> 'string to look for
> strFindMe = "FBO"

> 'cycling through all controls
> For Each ctl In Me.Controls

>     'only check Text and Combo boxes...
>     If ctl.ControlType = acTextBox Or ctl.ControlType = acComboBox Then

>         'looking for string
>         If InStr(ctl.Value, strFindMe) > 0 Then

>             intStart = InStr(ctl.Value, strFindMe) + Len(strFindMe)

>             'cutting off everything on the left of it
>             ctl.Value = Mid(ctl.Value, intStart)

>         End If

>     End If

> Next



Wed, 10 Dec 2003 00:38:30 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Need Ucase - with Instr Help

2. INSTR() FUNCTION: need help

3. Need help with InStr and Like

4. Need to locate CRLF with InStr

5. InStr Function Help

6. REQUEST: help with INSTR(

7. REQUEST: help with INSTR()

8. InSTR Help

9. Help with inSTR not working.

10. Help on InStr

11. Help, Instr Returns -1 !!!

12. Help: problem with Instr()

 

 
Powered by phpBB® Forum Software