i use ms access as database and i dont know why my code not working.. here some of code

Private Sub btnSimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSimpan.Click
        Dim conAccess As OleDb.OleDbConnection
        conAccess = New OleDb.OleDbConnection

        conAccess.ConnectionString = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" & Application.StartupPath & "\kptm.mdb"
        conAccess.Open()

        If txtNamaP.Text = "" Then
            MessageBox.Show("Sila isi nama penerima dahulu!", "Amaran!", MessageBoxButtons.OK)
        ElseIf txtNoStaf.Text = "" Then
            MessageBox.Show("Sila isi nombor staf penerima dahulu!", "Amaran!", MessageBoxButtons.OK)
        ElseIf ComboBoxSex.Text = "" Then
            MessageBox.Show("Sila pilih jantina penerima dahulu!", "Amaran!", MessageBoxButtons.OK)
        ElseIf ComboBoxDep.Text = "" Then
            MessageBox.Show("Sila pilih jabatan penerima dahulu!", "Amaran!", MessageBoxButtons.OK)
        ElseIf ComboBoxItem.Text = "" Then
            MessageBox.Show("Sila pilih jenis item!", "Amaran!", MessageBoxButtons.OK)
        ElseIf txtQtt.Text = "" Then
            MessageBox.Show("Sila masukkan kuantiti!", "Amaran!", MessageBoxButtons.OK)
        ElseIf DateTimePicker1.Text > Today Then
            MessageBox.Show("Sila masukkan tarikh yang betul, anda tidak dibenarkan mengeluarkan stok untuk masa hadapan!", "Amaran!", MessageBoxButtons.OK)
        Else


            Try

                Dim sql As String

                sql = "INSERT INTO rekod(nama, nostaf, jantina, jabatan, namaitem, kuantiti, tarikh, norekod)" & "value('" & txtNamaP.Text & "','" & txtNoStaf.Text & "','" & ComboBoxSex.Text & "','" & ComboBoxDep.Text & "','" & ComboBoxItem.Text & "','" & txtQtt.Text & "','" & txtQtt.Text & "','" & txtRekod.Text & "')"

                Dim Command As New OleDbCommand(sql, conAccess)
                Command.ExecuteNonQuery()
                conAccess.Close()
                MessageBox.Show("Tahniah !! Maklumat Tempahan Sudah Selamat Disimpan Dalam Pengkalan Data", "System Confirmation", MessageBoxButtons.OK)

            Catch ex As Exception
                MessageBox.Show("Maaf !!  Rekod Tidak Disimpan Dalam Pengkalan Data", "System Confirmation", MessageBoxButtons.OK)
            End Try

            conAccess.Close()

        End If
    End Sub

Hi,
compare your coding with below and do changes where is required and it should work.

Dim ROW As DataRow
        Dim Cmd As New OleDb.OleDbCommand
        OleDbConnection1.Open()

        
               With Cmd
            .CommandText = "INSERT INTO [MASKDATA] (VERSION, SMASK, EQP, FCAP, JCAP, YCAP)  VALUES  ('" & VERSION.Text & "', '" & SMASK.Text & "', '" & EQP.Text & "','" & FCAP.Text & "', '" & JCAP.Text & "', '" & YCAP.Text & "')"
            .CommandType = CommandType.Text
            .Connection = Me.OleDbConnection1
            .ExecuteNonQuery()
        End With

        OleDbConnection1.Close()
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.