SLQ troubleshooting needed...

battenberg

Burning candles both ends
Local time
Today, 18:31
Joined
Sep 25, 2006
Messages
118
I am trying write to a table the resuts of a selection from a combo box using the following SQL.

can anybody please help me with the correct syntax for this as I cannot get it working, and it's throwing up a syntax error.

Thanks

Code:
Dim sql As String
Dim strPartNumber As String
Dim strDescription As String
Dim strAHUuniqueID As String

'capture strings
strPartNumber = Me.Combo44.Column(0)
strDescription = Me.Combo44.Column(1)
strAHUuniqueID = Me.AHUuniqueID

sql = "INSERT INTO tblAncilleries ( PartNumber, ProductDescription ) VALUE ( " & strPartNumber & ", " & strDescription & " ) INNER JOIN tblAncilleries ON [tblAHU's].ProductID = tblAncilleries.ProductID WHERE ((([tblAHU's].AHUuniqueID) = " & strAHUuniqueID & ")) "


MsgBox "SQL:" & vbCrLf & vbCrLf & sql
'DoCmd.RunSQL sql
 
Try this way...

Product = Dlookup("[ProductID]","[tblAHU's]","[strAHUuniqueID] = " & Me.AHUuniqueID)

sql = "INSERT INTO tblAncilleries ( PartNumber, ProductDescription ) VALUES
( " & strPartNumber & ",'" & strDescription & "' ) Where [ProductID] = " & Product
 
thankyou will try it out...
 
thank you for a fresh way of thinking and helping me solve this..!!!
 

Users who are viewing this thread

Back
Top Bottom