Run-time error 3061

YUPAPA

Registered User.
Local time
Today, 22:39
Joined
Sep 28, 2002
Messages
11
HiHi :),

I am trying to insert values to a table, but it seems the code below cannot read what I entered on the form. I keep getting runtime error 3061!! I have two textboxes in my form (client_firstname,client_lastname). My user will then fill out the two boxes and click on Command20, it will insert values of the two textboxes into the table client_TBL.

Code:
Private Sub Command20_Click() {
    Dim SQL As String
    Set db = CurrentDb()

    SQL = "INSERT INTO client_TBL(client_firstname,client_lastname) VALUES(Me!client_firstname,Me!client_lastname)"
    db.Execute SQL
    
    MsgBox "Your client has been added"
}

Please help me... :p
 
Try this:-

Private Sub Command20_Click()
Dim db As Database
Dim SQL As String
Set db = CurrentDb()

SQL = "INSERT INTO client_TBL (client_firstname, client_lastname)" & _
" VALUES ( '" & Me!client_firstname & "','" & Me!client_lastname & "')"

db.Execute SQL
MsgBox "Your client has been added"

End Sub
 
Oh thank you! :)
 

Users who are viewing this thread

Back
Top Bottom