Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with finding a recordset using a text box

Status
Not open for further replies.

cptben5

Technical User
Nov 22, 2004
2
US
This is probably something simple, however, it has me frustrated.

I am trying to use a DoCmd.FindRecord to find records based on whatever the user types into the input textbox (txtFindNew) using the following code.

Private Sub cmdFind_Click()
Dim strTitle as String

strTitle = txtFindNew
DoCmd.FindRecord strTitle, , False, , True, , True

End Sub

This returns nothing and appears to refresh the first record, however, if I hard code a piece of text (ET) it works fine.

Private Sub cmdFind_Click()
Dim strTitle as String

strTitle = "ET"
DoCmd.FindRecord strTitle, , False, , True, , True

End Sub


Any ideas would be greatly appreciated.
 
Put a break point in your code on the DoCmd.FindRecord line, execute it, then mouseover the strTitle variable and make sure that the value from your form is being passed through. My hunch is that you need something like this:

Code:
Dim strTitle as String

strTitle = Me.txtFindNew.Value
DoCmd.FindRecord strTitle, , False, , True, , True

~Melagan
______
"It's never too late to become what you might have been.
 
No Dice. The value is being passed through and I tried your suggestion on the code aswell. Out of curiosity I tried doing the search while the third record set was being displayed and when I clicked Find it reverted to the first recordset.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top