I have created a form, when I add the first record, it works perfectly. After saving the first record, when I attempt to add the second record, it complains and gives me the error 2105. Can this be because the saving of the record has not been commited to the SQL server database? The code that I use to save the record is below
Please can anybody help me?
Code:
Dim cnn As New ADODB.Connection
Dim strSQL as string
strSQL = "INSERT INTO tblCompany (companyid, CompanyName,Address1,Address2,Address3,Address4,Postcode,Telephone,Email,Contact)" & _
"values ('" & company_id & "', '" & lvCompanyName & "' ,'" & Me.Address1 & "' ,'" & Me.Address2 & "' , '" & Me.Address3 & "' ," & _
"'" & Me.Address4 & "', '" & Me.Postcode & "', '" & Me.Telephone & "', '" & Me.Email & "'," & _
"'" & Me.Contact & "')"
Set cnn = CurrentProject.Connection
cnn.Execute strSQL, , adExecuteNoRecords
Please can anybody help me?