I'm trying to put an add function in my program. Here's how I did it:
Private Sub cmdreg_Click() If txtsn.Text = "" Or txtpw.Text = "" Then MsgBox "All fields are required!", vbOKOnly + vbInformation, "ERROR" Else Dbase Set rs = db.Execute("INSERT INTO TBL_STUDREG (StudentNumber, SPassword) VALUES (txtsn.text, txtpw.text)") rs.Update MsgBox "Record Saved!", vbOKOnly + vbInformation, "SUCCESS" db.Close End If End Sub
I don't understand why it won't work. I always get "No value given for one or more required parameters."
For this program I use a module. These are the codes in it:
Public db As New ADODB.Connection Public rs As New ADODB.Recordset Public Sub Dbase() db.CursorLocation = adUseClient db.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=LIBRARY.mdb" End Sub
This post has been edited by BobRodes: 20 November 2012 - 08:50 PM