Hi,
I have written the following code to insert records into a table in Access 2007:
The code works great if I enter numbers into the textboxs when I run the form, but if I enter letters I get the following error:
"Too few parameters. Expected 3."
Does anyone have any ideas why it will accept numbers but not letters?
thanks,
Jeff
I have written the following code to insert records into a table in Access 2007:
Code:
Option Compare Database Dim DueDate As String Dim PO As String Dim Customer As String Private Sub Command1_Click() CurrentDb.Execute "INSERT INTO Table2 ([DueDate],[PO],[Customer]) VALUES (" & DueDate & "," & PO & "," & Customer & ")" DoCmd.Close acForm, "Form1", acSaveNo End Sub Private Sub TxtCust_Exit(Cancel As Integer) Customer = TxtCust.Text End Sub Private Sub TxtDate_Exit(Cancel As Integer) DueDate = TxtDate.Text End Sub Private Sub TxtPO_Exit(Cancel As Integer) PO = TxtPO.Text End Sub
The code works great if I enter numbers into the textboxs when I run the form, but if I enter letters I get the following error:
"Too few parameters. Expected 3."
Does anyone have any ideas why it will accept numbers but not letters?
thanks,
Jeff
Comment