View Full Version : Problem.. Too few parameters. expected 1.


Maysan
12-16-2010, 04:35 AM
I´m trying to save a textbox-value to a table called Contacts and the filed named SlipScannedECMDate. But I get this messages: Too few parameters. expected 1.
Can anyone help me with this problem?

Private Sub cmdSave_Click()
Dim lRecordValue As String
Dim lDatum As String
On Error GoTo Err_cmdSave_Click
'DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
' Module1.IsDirty = False

If MsgBox("Save changes to record?", vbYesNo) = vbYes Then

lRecordValue = RecordID.Value

lDatum = ECMDate.Value

CurrentDb.Execute ("UPDATE Contracts SET SlipScannedECMDate =" & lDatum & " WHERE RecordID = lRecordValue")


End If



Thanks :)

vbaInet
12-16-2010, 05:00 AM
Comment out the Error Handler line and run the code to see where it highlights.

Maysan
12-16-2010, 05:06 AM
Comment out the Error Handler line and run the code to see where it highlights.


It´s in this line:
CurrentDb.Execute ("UPDATE Contracts SET SlipScannedECMDate =" & lDatum & " WHERE RecordID = lRecordValue")

vbaInet
12-16-2010, 05:19 AM
You need to bring out the string variable just like you did with lDatum.
CurrentDb.Execute ("UPDATE Contracts SET SlipScannedECMDate =" & lDatum & " WHERE RecordID = '" & lRecordValue & "'")What is the datatype of RecordID?

Maysan
12-16-2010, 05:54 AM
You need to bring out the string variable just like you did with lDatum.
CurrentDb.Execute ("UPDATE Contracts SET SlipScannedECMDate =" & lDatum & " WHERE RecordID = '" & lRecordValue & "'")What is the datatype of RecordID?


Thanks!!! :p

vbaInet
12-16-2010, 06:17 AM
Glad to help ;)