Too few parameters. Expected 1????

gmatriix

Registered User.
Local time
Today, 16:37
Joined
Mar 19, 2007
Messages
365
Hello All,

I have a questions. This code was working fine but, when I added more data to the table it would error "saying overflow" so I changed

Dim pID As Interger to
Dim pID as Long

Now it is saying "Too few parameters. Expected 1. Its has an error on the line that says "dbs.Execute cmd, dbSeeChanges"

Not sure what this means.
Here is the code.
Code:
Private Sub Form_AfterUpdate()
Dim dd As Date
    Dim dbs As DAO.Database
    Set dbs = CurrentDb
    Dim pID As Long
    Dim sHostName As String
    Dim sUserName As String
    Dim cmd As String
    pID = [product id].Value 
    dd = Format(Now(), "dd/mm/yyyy hh:mm:ss")
    ' Get Host Name / Get Computer Name
    sHostName = Environ("computername")
    ' Get Current User Name
    sUserName = Environ("username")        'Username is obtained to produce Time and UserStamp
    cmd = "UPDATE Product SET DateStamp=#" & dd & "#, UserStamp='" & sUserName & "' WHERE [productID]=" & pID & ""
    dbs.Execute cmd, dbSeeChanges
End Sub

Any Ideas??
 
Last edited:
Hello All,

I solved it myself...Woopeee! right? Still Learning...I found the out by searching the forum. If this is the error, then most likely there is a field that does not exist. So check the code again and wala! found the error.

Corrected it and now it is working fine!

Awesome!

Thanks everyone!:D
 

Users who are viewing this thread

Back
Top Bottom