Help Using .FIND 
Author Message
 Help Using .FIND

What is happening is I have three find buttons using similar code.

 Find Name:

Dim strNameA as String
Dim strNameB as string
strNameA = InputBox("First, enter the patricipants FIRST NAME ONLY:", "Find
Participant", "")
If strNameA = "" Then
    Exit Sub
End If
strNameB = InputBox("OK. Now enter the patricipants LAST NAME ONLY:", "Find
Participant", "")
If strNameB = "" Then
    Exit Sub
End If
'
With Me.datRef.Recordset
    .Filter = "Fname='" & strNameA & "' AND Lname='" & strNameB & "'"
    If datRef.Recordset.EOF And datRef.Recordset.BOF Then
        MsgBox "No Records Match"
        .MoveFirst
        Exit Sub
    End If
End With

 Find ID:
datRef.Recordset.MoveFirst
varID = InputBox("Enter Family ID Number:", "Find Participant", "")
If varID = "" Then
    Exit Sub
End If
'
With Me.datRef.Recordset
    .Find "ID='" & varID & "'"
    If Me.datRef.Recordset.EOF Or Me.datRef.Recordset.BOF Then
        MsgBox "No Records Match"
    .MoveFirst
    End If
    End With

The Find ID method works if I DO NOT use FIND NAME method first.
But if I find the name, I cannot search for a different ID after that.



Wed, 22 Oct 2003 03:28:16 GMT  
 Help Using .FIND
Mostly due to the filter that you put on in the Find by name part, and dont
take off, so your recordset is still filtered.

Try:
Me.datRef.Recordset.Filter=""
just before the FindID: label

Quote:
> What is happening is I have three find buttons using similar code.

>  Find Name:

> Dim strNameA as String
> Dim strNameB as string
> strNameA = InputBox("First, enter the patricipants FIRST NAME ONLY:",
"Find
> Participant", "")
> If strNameA = "" Then
>     Exit Sub
> End If
> strNameB = InputBox("OK. Now enter the patricipants LAST NAME ONLY:",
"Find
> Participant", "")
> If strNameB = "" Then
>     Exit Sub
> End If
> '
> With Me.datRef.Recordset
>     .Filter = "Fname='" & strNameA & "' AND Lname='" & strNameB & "'"
>     If datRef.Recordset.EOF And datRef.Recordset.BOF Then
>         MsgBox "No Records Match"
>         .MoveFirst
>         Exit Sub
>     End If
> End With

>  Find ID:
> datRef.Recordset.MoveFirst
> varID = InputBox("Enter Family ID Number:", "Find Participant", "")
> If varID = "" Then
>     Exit Sub
> End If
> '
> With Me.datRef.Recordset
>     .Find "ID='" & varID & "'"
>     If Me.datRef.Recordset.EOF Or Me.datRef.Recordset.BOF Then
>         MsgBox "No Records Match"
>     .MoveFirst
>     End If
>     End With

> The Find ID method works if I DO NOT use FIND NAME method first.
> But if I find the name, I cannot search for a different ID after that.



Wed, 22 Oct 2003 03:39:49 GMT  
 Help Using .FIND
Thgank You,

It WORKED

Jay

Quote:
> Mostly due to the filter that you put on in the Find by name part, and
dont
> take off, so your recordset is still filtered.

> Try:
> Me.datRef.Recordset.Filter=""
> just before the FindID: label


> > What is happening is I have three find buttons using similar code.

> >  Find Name:

> > Dim strNameA as String
> > Dim strNameB as string
> > strNameA = InputBox("First, enter the patricipants FIRST NAME ONLY:",
> "Find
> > Participant", "")
> > If strNameA = "" Then
> >     Exit Sub
> > End If
> > strNameB = InputBox("OK. Now enter the patricipants LAST NAME ONLY:",
> "Find
> > Participant", "")
> > If strNameB = "" Then
> >     Exit Sub
> > End If
> > '
> > With Me.datRef.Recordset
> >     .Filter = "Fname='" & strNameA & "' AND Lname='" & strNameB & "'"
> >     If datRef.Recordset.EOF And datRef.Recordset.BOF Then
> >         MsgBox "No Records Match"
> >         .MoveFirst
> >         Exit Sub
> >     End If
> > End With

> >  Find ID:
> > datRef.Recordset.MoveFirst
> > varID = InputBox("Enter Family ID Number:", "Find Participant", "")
> > If varID = "" Then
> >     Exit Sub
> > End If
> > '
> > With Me.datRef.Recordset
> >     .Find "ID='" & varID & "'"
> >     If Me.datRef.Recordset.EOF Or Me.datRef.Recordset.BOF Then
> >         MsgBox "No Records Match"
> >     .MoveFirst
> >     End If
> >     End With

> > The Find ID method works if I DO NOT use FIND NAME method first.
> > But if I find the name, I cannot search for a different ID after that.



Wed, 22 Oct 2003 04:33:42 GMT  
 Help Using .FIND
Like, you doubted me? :)
This was a quality solution.

Quote:
> Thgank You,

> It WORKED

> Jay


> > Mostly due to the filter that you put on in the Find by name part, and
> dont
> > take off, so your recordset is still filtered.

> > Try:
> > Me.datRef.Recordset.Filter=""
> > just before the FindID: label


> > > What is happening is I have three find buttons using similar code.

> > >  Find Name:

> > > Dim strNameA as String
> > > Dim strNameB as string
> > > strNameA = InputBox("First, enter the patricipants FIRST NAME ONLY:",
> > "Find
> > > Participant", "")
> > > If strNameA = "" Then
> > >     Exit Sub
> > > End If
> > > strNameB = InputBox("OK. Now enter the patricipants LAST NAME ONLY:",
> > "Find
> > > Participant", "")
> > > If strNameB = "" Then
> > >     Exit Sub
> > > End If
> > > '
> > > With Me.datRef.Recordset
> > >     .Filter = "Fname='" & strNameA & "' AND Lname='" & strNameB & "'"
> > >     If datRef.Recordset.EOF And datRef.Recordset.BOF Then
> > >         MsgBox "No Records Match"
> > >         .MoveFirst
> > >         Exit Sub
> > >     End If
> > > End With

> > >  Find ID:
> > > datRef.Recordset.MoveFirst
> > > varID = InputBox("Enter Family ID Number:", "Find Participant", "")
> > > If varID = "" Then
> > >     Exit Sub
> > > End If
> > > '
> > > With Me.datRef.Recordset
> > >     .Find "ID='" & varID & "'"
> > >     If Me.datRef.Recordset.EOF Or Me.datRef.Recordset.BOF Then
> > >         MsgBox "No Records Match"
> > >     .MoveFirst
> > >     End If
> > >     End With

> > > The Find ID method works if I DO NOT use FIND NAME method first.
> > > But if I find the name, I cannot search for a different ID after that.



Wed, 22 Oct 2003 22:13:45 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. HELP using FIND

2. Using Find and Replace to find Section Breaks

3. Find multiple words Using MS Word Find

4. Writing Find and Replace Dialogs using RichTextBox.Find Function

5. Find / Find next routine using ADO

6. Help! Code using Find{Next,Previous} in RecordsetClone

7. Help with Using Find, and CTRL+BREAK

8. Help using the Find feature

9. Using CodeModule.Find method in Word VBE - help!

10. Please help - error using .Find method

11. Help : How to find the path of a file in my hard disk using VB

12. Help need way of finding out about dll's VBapp uses

 

 
Powered by phpBB® Forum Software