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

Too few parameters. Expected 1

Status
Not open for further replies.

primagic

IS-IT--Management
Jul 24, 2008
476
GB
Anyone know why I am getting too few parameters error on the following code. I am trying to find the first record (in a query) where a field = 'free' and display it.

Code:
Dim db As Database
Dim rst As DAO.Recordset
Dim strFound As String, strCriteria As String
Set db = CurrentDb
Set rst = db.OpenRecordset("NextTaskList")
strCriteria = "TempAdviserLock = 'Free'"
rst.FindFirst strCriteria
strFound = rst.Bookmark
rst.Close
[code]
 
How are ya primagic . . .

Try the following instead:
Code:
[blue]   Dim db As [purple][b]DAO[/b][/purple].Database, rst As DAO.Recordset
   Dim strFound As String, strCriteria As String
   
   Set db = CurrentDb
   Set rst = db.OpenRecordset("NextTaskList", [purple][b]dbOpenDynaset[/b][/purple])
   strCriteria = "[TempAdviserLock] = 'Free'"
   rst.FindFirst strCriteria
   
   [purple][b]If rst.NoMatch Then[/b][/purple]
      MsgBox "Record Not Found!"
   Else
      strFound = rst.Bookmark
   End If
   
   [purple][b]Set rst = Nothing
   Set db = Nothing[/b][/purple][/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
I'd check the real name of the column TempAdviserLock in NextTaskList.


[pipe]
Daniel Vlas
Systems Consultant

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top