Please have a look at the code:
Private Sub Command0_Click()
Dim name1 As String
name1 = Text1.Value
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.Open ("C:\Data\SampleDB.mdb")
Dim myCommand As ADODB.Command
Set myCommand = New ADODB.Command
myCommand.ActiveConnection = conn
myCommand.CommandText = "INSERT INTO Table1(name) VALUES(name1)"
Dim rs As ADODB.Recordset
Set rs = myCommand.Execute(myCommand.CommandText)
rs.Close
Set rs = Nothing
Executing this code generates Run time error - No value given for one or more required parameters
Please resolve my problem!
Private Sub Command0_Click()
Dim name1 As String
name1 = Text1.Value
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.Open ("C:\Data\SampleDB.mdb")
Dim myCommand As ADODB.Command
Set myCommand = New ADODB.Command
myCommand.ActiveConnection = conn
myCommand.CommandText = "INSERT INTO Table1(name) VALUES(name1)"
Dim rs As ADODB.Recordset
Set rs = myCommand.Execute(myCommand.CommandText)
rs.Close
Set rs = Nothing
Executing this code generates Run time error - No value given for one or more required parameters
Please resolve my problem!