I am trying to use a form to insert new records into a table. I have a function that is called,
Code:
Function Insert_Asset_Click(ByVal AssetTag As String, ByVal Make As String, ByVal Model As String, ByVal ServiceTag As String)
Dim conn As ADODB.Connection
Dim cmd As ADODB.Command
Dim rs As ADODB.Recordset
Dim myErr As ADODB.Error
Dim strError As String
On Error GoTo myHandler
'Dim sConn As String
Dim query As String
'MsgBox "Got Here" 'Debug command
Set conn = CurrentProject.Connection
Set cmd = New ADODB.Command
cmd.ActiveConnection = CurrentProject.Connection
cmd.CommandText = "INSERT INTO Device(AssetTag, Make, Model, ServiceNum) VALUES(" + AssetTag + ", " + Make + ", " + Model + ", " + ServiceNum + ");"
cmd.CommandType = adCmdText
'Set rs = cmd.Execute
DoCmd.RunMacro "Converted Macro-Clear_Insert_Device", 1
'Close connection to database
conn.Close
Exit Function
I have no idea why all i see in the table is one record after multiple attempts to insert different records into the table. I get no error messages. I am new to coding with VBA so i bet its something simple, but i'm totally confused.