Hi all,
I am building a basic form that requires several text boxes to be captured and inserted into a table appropriately, however as I have added the final textbox into my VBA code I get a 3134 error and cannot seem to find where I have gone wrong.
The code is as follows:
Private Sub cmdAdd_Click()
Dim strInsert As String
If IsNull(Me.txtPolicyNum) Or IsNull(Me.txtinception) Or IsNull(Me.txtExpiryDAte) Or IsNull(Me.txtAccountNumber) Then
MsgBox "Please complete Policy Details"
Else
strInsert = "insert into VehicleRecords (Vehicle_is_registered, State_of_Registration, Redbook_code, Full_description, Vehicle_value, Standard_accessories, yn_nonstandard_accessories, yn_vehicle_mods, Value_NSA_Mods, NS_accessories, Policy_record, Inception_Date, Expiry_Date, Account_Number, Registration_Number, State_of_base_operations, Suburb, Postcode, CoverType, Standard_excess, Imposed_excess, Total_variable_excess, No_claim_bonus_entitlement, claim_bonus_verified, protect_noclaim_bonus, Class, Make, Model, Build_Year, PremiumAmount, FireLevy, GST, StampDuty)" & _
"values( " & Me.cboVehicleRegistered & ",'" & Me.cboStateofRego & "','" & Me.txtRedbook & "','" & Me.txtFulldescription & "','" & Me.txtVehicleValue & "','" & Me.txtStandardaccessories & "','" & Me.cboNSAccessories & "','" & Me.cboMods & "','" & Me.txtModsValues & "','" & Me.txtnonstandardaccessories & "','" & Me.txtPolicyNum & "','" & Me.txtinception & "','" & Me.txtExpiryDAte & "','" & Me.txtAccountNumber & "','" & Me.txtRegoNumber & "','" & Me.cboBaseOps & "','" & Me.txtBaseOperations & "','" & Me.txtPostcode & "','" & Me.cboCoverType & "','" & Me.txtStandardaccessories & "','" & Me.txtImposedExcess & "','" & Me.txtTotalVariableExcess & "','" & Me.cboNoClaimBonusEntit & "','" & Me.cboVerifynoClaimBonus & "','" & Me.cboProtectNoClaim & "','" & Me.cboClass & "','" & Me.cboMake & "','" & Me.cboModel & "','" & Me.txtBuildYear & "','" & Me.txtPremium & "','" & Me.txtFire & "','" & Me.txtGST & "','" & Me.txtStamp & "')"
DoCmd.SetWarnings False
DoCmd.RunSQL strInsert
DoCmd.SetWarnings True
MsgBox "Vehicle added successfully"
'add data to table
End If
'refresh data from list on form
subfrmVehicleRecords.Form.Requery
End Sub
Any assistance or suggestions would be greatly appreciated.
I am building a basic form that requires several text boxes to be captured and inserted into a table appropriately, however as I have added the final textbox into my VBA code I get a 3134 error and cannot seem to find where I have gone wrong.
The code is as follows:
Private Sub cmdAdd_Click()
Dim strInsert As String
If IsNull(Me.txtPolicyNum) Or IsNull(Me.txtinception) Or IsNull(Me.txtExpiryDAte) Or IsNull(Me.txtAccountNumber) Then
MsgBox "Please complete Policy Details"
Else
strInsert = "insert into VehicleRecords (Vehicle_is_registered, State_of_Registration, Redbook_code, Full_description, Vehicle_value, Standard_accessories, yn_nonstandard_accessories, yn_vehicle_mods, Value_NSA_Mods, NS_accessories, Policy_record, Inception_Date, Expiry_Date, Account_Number, Registration_Number, State_of_base_operations, Suburb, Postcode, CoverType, Standard_excess, Imposed_excess, Total_variable_excess, No_claim_bonus_entitlement, claim_bonus_verified, protect_noclaim_bonus, Class, Make, Model, Build_Year, PremiumAmount, FireLevy, GST, StampDuty)" & _
"values( " & Me.cboVehicleRegistered & ",'" & Me.cboStateofRego & "','" & Me.txtRedbook & "','" & Me.txtFulldescription & "','" & Me.txtVehicleValue & "','" & Me.txtStandardaccessories & "','" & Me.cboNSAccessories & "','" & Me.cboMods & "','" & Me.txtModsValues & "','" & Me.txtnonstandardaccessories & "','" & Me.txtPolicyNum & "','" & Me.txtinception & "','" & Me.txtExpiryDAte & "','" & Me.txtAccountNumber & "','" & Me.txtRegoNumber & "','" & Me.cboBaseOps & "','" & Me.txtBaseOperations & "','" & Me.txtPostcode & "','" & Me.cboCoverType & "','" & Me.txtStandardaccessories & "','" & Me.txtImposedExcess & "','" & Me.txtTotalVariableExcess & "','" & Me.cboNoClaimBonusEntit & "','" & Me.cboVerifynoClaimBonus & "','" & Me.cboProtectNoClaim & "','" & Me.cboClass & "','" & Me.cboMake & "','" & Me.cboModel & "','" & Me.txtBuildYear & "','" & Me.txtPremium & "','" & Me.txtFire & "','" & Me.txtGST & "','" & Me.txtStamp & "')"
DoCmd.SetWarnings False
DoCmd.RunSQL strInsert
DoCmd.SetWarnings True
MsgBox "Vehicle added successfully"
'add data to table
End If
'refresh data from list on form
subfrmVehicleRecords.Form.Requery
End Sub
Any assistance or suggestions would be greatly appreciated.