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 SkipVought 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.

JSD1976

Programmer
Aug 17, 2004
16
0
0
US
Hello

I am working with VB6, which I have linked to an Acces db. I used a Data button to link to 'tblmain' in the Acces db. On the VB form, I can view records from this table (next, previous), but I am trying to find a way to find a record on one form using an unbound text box and a command button. I want the user to be able to type a part number in the unbound text box (Text0), then click the command button to search for the matching record. I have this so far:

Dim rs As ADODB.Recordset

Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\jsdegard\Desktop\PieceWeight.mdb;User Id=admin;Password=;"

Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open "Select * From tblmain Where Text1='" & Text0.Text & "'", cn, adOpenKeyset, adLockOptimistic

I am getting an error:

'No value given for one or more required parameters'

Any idea what the problem could be? Any thoughts on this would be extremely helpful and appreciated.

Thanks

Jeremy
 
Is text1 is a field in tblMain?
is it defined as string or integer in tblMain.
Check these first.
nivini
 
You won't please people duplicating your threads. Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top