Dear All,
I am beginner for MS Access 2013 vba programming .I had a MS Access form with multiple text-boxes and I tried to insert multiple text-box values into Access table.
I tried to insert in two ways , 1 getting all the text-box values into variables and executing the command .Other using text-boxes directly into insert command .But I am getting failure in both the ways and facing error 128.
Can any one help me how can I achieve this with my below code.
Code :
Dim intResponse, tempmobilenumber As Integer
Dim strMsg As String
Dim strSQL As String
Dim tempname, tempaddress, tempemailaddress As String
strMsg = "You are about to Save Customer Information?"
intResponse = MsgBox(strMsg, vbExclamation + vbYesNo, "Save Information?")
If (intResponse = vbYes) Then
tempname = Me.txtname.Value
tempaddress = Me.txtaddress.Value
strSQL = "INSERT INTO CustomerInfo(Name,Address,Mobilenumber,EmailAddress) VALUES (' " & Me.txtname.Value & " ' , ' " & Me.txtaddress.Value & " ' , ' " & Me.txtmobilenumber.Value & " ' , '" & Me.txtaddress.Value & " ' );"
CurrentDb.Execute strSQL, dbFailOnError + dbSeeChanges
strMsg = "Rupees ' " & Me.txtname & " ' Saved Successfully"
MsgBox strMsg, vbInformation, "Save Complete"
Thanks, Quality Communication Provides Quality Work.
Sid