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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding a record

Status
Not open for further replies.
Nov 27, 2002
8
US
This has been stumping me for two days now. I would like to goto a certain record based on input from a text box.

1> datSecondRS.Recordset.FindFirst "[flightID]=txtFlg.text"

I thought line 1 would do it however I get a Run-time Error 3070 "jet database engine does not recongize txtflg.text"

2> datSecondRS.Recordset.FindFirst "[flightID]= '" & txtFlg
.Text & "'"

So then I tried line 2, now I get run-time error 3046 "Data type mismatch in criteria expression"

The text field displays a number (and its formated as a number)if sub in the number "18" in place of txtflg.text
the command works fine. I am using a VB front end to a MS Access 2000 database.

Any suggestions?
Neal
 
Try convertinf the number in txtflg.Text to whatever the field flightID is.

eg.

CInt(txtflg.Text)

Rob
 
You are checking for a literal value 'txtFlag.text'

datSecondRS.Recordset.FindFirst "[flightID]=txtFlg.text"

What you need is the value stored in txtFlag.text

datSecondRS.Recordset.FindFirst ("[flightID] = " & txtFlg.text)
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
I am having the same problem but in a WHERE query in access but nothing above works.

Like above typing in the value works but not the refreance?
 
Post a copy of your SQL string as it is actually composed, along with your data field types.
Use debug.Print then Copy/Paste on the SQL string - that always helps find missing spaces etc.


________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top