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

Code Question

Status
Not open for further replies.

nag9127

Technical User
Mar 15, 2007
76
US
The code below is producing a "Too Few parameters. Expected 1" error. Item is a text field in the table and the form. I think my syntax might have an error. Any help would be appreciated. Thank you!

Code:
Dim CurDB As Database
Dim rs As recordset

Set CurDB = CurrentDb
Set rs = CurDB.OpenRecordset("SELECT * from ItemTable WHERE" & _
" Item =" & Forms!EditBulkProductForm!Item)

If rs!Description = Me.Description And rs!UnitOfMeasure = Me.UnitOfMeasure Then
    Me.SaveItemChangesCommand.Enabled = False
    rs.Close
    Set rs = Nothing
End If
 
If ITEM is text then you will need quotes.

Set rs = CurDB.OpenRecordset("SELECT * from ItemTable WHERE" & _
" Item =" & Chr(34) & Forms!EditBulkProductForm!Item & Chr(34))


HTH RuralGuy (RG for short) acXP winXP Pro
Please respond to this forum so all may benefit
 
Code:
[blue]Set rs = CurDB.OpenRecordset("SELECT * from ItemTable WHERE" & _
" Item = [red][b]'[/b][/red]" & Forms!EditBulkProductForm!Item & "[red][b]'[/b][/red]", dbopendynaset)"[/blue]
By chance are you using Access 97?

If 2K or above you need DAO.Database & DAO.Recordset . . .

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top