Results 1 to 14 of 14

Thread: Syntax error VB/MS Access

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2018
    Posts
    16

    Question Syntax error VB/MS Access

    I NEED HELP FOR FIX SOME ERRORS. I WANT TO SAVE MY DETAILS INTO MS ACCESS DATABASE. BUT WHEN I CLICK THE SAVE BUTTON ITS SHOW Syntax error (missing operator) in query expression . I ALREADY FIND THE GOOGLE AND CANT FIX IT MYSELF. SO PLZ HELP ME TO FIX THIS.
    Code:
    Dim strText() As String
            Dim strDate As String
            strDate = Me.date1.Text
            strText = Split(Me.cmbSSelect.Text, vbCrLf)
            Dim cmd As New OleDb.OleDbCommand
    
    
            If Not rs.State = ConnectionState.Open Then
                'open connection if it not yet open
                rs.Open()
            End If
    
            cmd.Connection = rs
            'add data to table
            cmd.CommandText = "INSERT INTO dpdata(DPNo, DPDate, Supplier, Des, Amount) " & _
                              " VALUES(" & Me.TextBox2.Text & ",'" & strDate & ",'" & strText(0) & ",'" & Me.TextBox7.Text & ",'" & Me.TextBox4.Text & "')"
            cmd.ExecuteNonQuery()
    
            'close connection
            rs.Close()
            MsgBox("Record Added Successfully")
    Attached Images Attached Images  

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width