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 error

Status
Not open for further replies.

random75

Technical User
Apr 16, 2008
34
US
I have this code which is producing a 'too few parameters Expected 1' error. Thanks for any help!

Code:
Dim CurDB As Database
Dim rs As recordset
Dim Resp As Integer

Set CurDB = CurrentDb
Set rs = CurDB.OpenRecordset("SELECT * from BatchMasterTemplateTable WHERE" & _
" ItemProduced =" & Me.ItemProduced)

If rs.RecordCount = 0 Then
    rs.Close
    Set rs = Nothing
    Else
    rs.MoveFirst
    Do Until rs.EOF
        If rs!TemplateDescription = Me.TemplateDescription Then
            Resp = MsgBox("Template Description Already Exists for This Item!", _
            vbOKOnly, vbExclamation, , "Template Description Already Exists!")
            Cancel = True
        End If
    rs.MoveNext
    Loop
    rs.Close
    Set rs = Nothing
End If
 
I should have mentioned this is Access 2000 and this code is in the BeforeUpdate event of a control.
 
Step through and check the value of Me.ItemProduced.
 
No, it is a required field in that table.
 
I don't quite get what you are saying. Which line is returning the error?

The error you mention generally means that a value is missing, which is why I suggested checking the value of Me.ItemProduced, that is the control, not the field.
 
I solved the problem. ItemProduced is a string field so I changed the where clause from this...

" ItemProduced =" & Me.ItemProduced)

to this...

" ItemProduced ='" & Me.ItemProduced & "'")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top