Sql

IanT

Registered User.
Local time
Today, 21:15
Joined
Nov 30, 2001
Messages
191
Hi
I am trying to append data from a form to a table. I have completed the vba below with out success. Can anyone help!

Dim intBatchNumber As Integer
Dim strType As String
Dim dbs As Database

Set dbs = OpenDatabase("PrintActivity.mdb")

intBatchNumber = Forms![New_frmPrintActivityAmend]![PrintBatchNumber]
strType = Forms![New_frmPrintActivityAmend]![Type]

dbs.Execute "INSERT INTO tblDeletedBatches (PrintBatchNumber, Type) VALUES ('intBatchNumber', 'strType');"

dbs.Close

End Sub

Thanks in advance..........
 
Try this instead...
Code:
DoCmd.RunSQL ("INSERT INTO tblDeletedBatches (PrintBatchNumber, Type) VALUES ('" & intBatchNumber & "', '" & strType & "');")
You have to keep your strings out of the quotes.
 

Users who are viewing this thread

Back
Top Bottom