This is my code to save values in MS access...but when i click on save it shows "INSERT INTO STATEMENT error"
Plz som1 help!!!!

Private Sub save_Click()
'Text4.Text = cmbCustID.Text
'Text3.Text = cmbLocation1.Text
'Text5.Text = cboSize1.Text
Dim temp As Integer
'On Error GoTo eror
blnerror = False
myValidation

If blnerror = False Then

If action = "insert" Then
    'birth = custdate.Value '.Month & "/" & bdate.Day & "/" & bdate.Year
     dateFrom = Fdate.Value
     dateTo = TDate.Value
    
Set con = New ADODB.Connection
con.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Advertisement.mdb;"
con.Open
Set rs = New ADODB.Recordset
rs.Supports (adMovePrevious)
rs.ActiveConnection = con
rs.Source = "select max(AD_ID) from [Magazine]"
rs.Open
blnflag = False


If Not rs.EOF Then
  rs.MoveFirst
  temp = rs.Fields(0)
End If
rs.Close
con.Close

    dateFrom = Fdate.Value
    dateTo = TDate.Value
    
    Set con = New ADODB.Connection
    con.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Advertisement.mdb;"
    con.Open
    Set rs = New ADODB.Recordset
    Set cmd = New ADODB.Command
    cmd.ActiveConnection = con
   
    con.Execute "insert into Magazine(AD_ID,CUST_ID,Date_From,Date_To,Emp_ID,TOTAL_RATE,Magazine_Name,size) values(" & temp + 1 & "," & cboCustID.Text & ",'" & dateFrom & "','" & dateTo & "'," & txtEmpID.Text & "," & txtTotal1.Text & ",'" & cboMagazine1.Text & "'," & cboSize1.Text & ")"
    MsgBox "One Row Inserted..." & vbCrLf & "New Banner Adverisement ", vbOKOnly, "New Customer Insertion"
    clear_screen
    con.Close
    action = "edit"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.