3239
Technical User
- May 14, 2003
- 64
I am trying to learn how to program using VBA and SQL. I created a Sub routine that I want to use to insert records from an unbound form into a table. When I call the procedure from the Click event on the button of my form, I get an error message "Run-time error 2498 the expression you entered is the wrong data type for one of the arguments"
Here is my code:
Public Sub AddRec()
Dim frm As Form_frmEmployees
Set frm = Forms!frmEmployees
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO Clients(First,Last)" & _
"SELECT" & frm.First & " As Expr1,'", frm.Last & " As Expr2;"
DoCmd.SetWarnings True
End Sub
Can anyone tell me whats wrong with my code?
thanks tony
Here is my code:
Public Sub AddRec()
Dim frm As Form_frmEmployees
Set frm = Forms!frmEmployees
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO Clients(First,Last)" & _
"SELECT" & frm.First & " As Expr1,'", frm.Last & " As Expr2;"
DoCmd.SetWarnings True
End Sub
Can anyone tell me whats wrong with my code?
thanks tony