VB Recordset Problem

ThunderBolt

Registered User.
Local time
Today, 22:42
Joined
Apr 29, 2003
Messages
25
I am fustrated by this section of code. I keep receiving the following error message when attempting to run the following code:

Private Sub Confirmbutt_Click()
Dim Db As Database
Dim R As Recordset

Set Db = CurrentDb()
Set R = Db.OpenRecordset("propertyIDSearch")
Me![PropertyID] = R(0)
R.Close
End Sub

Error message:
"Run-Time error 3061
Too few parameters. Expected 2."

PropertyIDSearch is the name of a query.
PropertyID is the name of a text box on my form
(Im trying to place the first and only value from the query into the text box)

Any help on why things are not working would be much appreciated. I feel it has something to do with an incorrect declaration of a recordset??

regards,
Thunderbolt:confused:
 
ThunderBolt said:
I feel it has something to do with an incorrect declaration of a recordset??


No, you just have to declare the Parameters too when using DAO.
 
Instead of all that why not try the Left() or DLookup() function or you might need a combination of both.
 
Please could you define 'parameters', i don't quiet understand.

regards,
thunderbolt
 

Users who are viewing this thread

Back
Top Bottom