General discussion
June 14, 2005 at 04:17 AM
jdlp

MS Access: Run-time error 3061

by jdlp . Updated 21 years, 3 months ago

i’m trying to create a form that when you search for a Code number, it populates certain fields!

but everytime i run it i get “Run-time error 3061” “Too few Parameters. Expected 1.”

below is the code, however i will require several of these search boxes, one already runs with a pretty similar code, only the variable names and source have been changed.

———————————————-
Private Sub TxtSCode_Exit(Cancel As Integer)
‘ Enter key was pressed, Lookup the appropriate product code
Dim strSCode As String
Dim StrSSQL As String
Dim rsSProductDetails As Recordset
strSCode = TxtSCode & “”
If strSCode = “” Then
‘ If Text Box is empty do nothing
Exit Sub
End If
‘ Otherwise find the appropriate Product Code
StrSSQL = “Select * from refProductCodes where SCode = ‘” & strSCode & “‘”
Set rsSProductDetails = CurrentDb().OpenRecordset(StrSSQL)

If Not rsSProductDetails.EOF Then
rsSProductDetails.MoveFirst
‘Update the ProductCode field
Me.ProductCode = rsSProductDetails.Fields(“ProductCode”)
‘ Update the ProductType field
Me.ProductType = rsSProductDetails.Fields(“Type”)

rsSProductDetails.Close
Else
MsgBox “Bar Code not found”, , “Brita Damages”
rsSProductDetails.Close
DoCmd.CancelEvent
End If

‘ Empty the TextBox

TxtSCode = “”
End Sub
———————————————–

is there something i’m missing !!

This discussion is locked

All Comments