R
RichUE
I have a problem with the following routine. It's an Event Procedure that
runs when the value in the textbox ANB_Qty on frm_Multipliers is changed. I
want the Quantity field in a specified record in tbl_Multipliers to be
updated using the textbox value.
At the moment there is a syntax error in the strSQL statement and I've spent
too long trying to find it. Can you help?
Private Sub ANB_Qty_Change()
' Update value to Quantity in tbl_Multipliers
Dim dbs As Database
Dim tbl_Multipliers As Recordset
Dim a, b, c, strSQL As String
Dim d As Integer
' Return reference to current database.
Set dbs = CurrentDb
' Create SQL string.
' strSQL = "UPDATE tbl_Multipliers SET tbl_Multipliers!Quantity =
'Forms!frm_Multipliers!ANB_Qty.Text'" _
& "WHERE tbl_Multipliers!Parent = 'CoSE001' AND
tbl_Multipliers!Component = 'CoSE003'"
strSQL = "UPDATE tbl_Multipliers SET QUANTITY =
frm_Multipliers!ANB_Qty.Text " _
& "WHERE PARENT = 'CoSE001' AND COMPONENT = 'CoSE003'"
dbs.Execute strSQL
' b = "SELECT tbl_Multipliers!PARENT' FROM tbl_Multipliers WHERE "
' c = "tbl_Multipliers!COMPONENT"
' Run action query.
MsgBox ("ANB_Qty.Text = " & d)
' Return number of records updated.
Debug.Print dbs.RecordsAffected
Set dbs = Nothing
End Sub
runs when the value in the textbox ANB_Qty on frm_Multipliers is changed. I
want the Quantity field in a specified record in tbl_Multipliers to be
updated using the textbox value.
At the moment there is a syntax error in the strSQL statement and I've spent
too long trying to find it. Can you help?
Private Sub ANB_Qty_Change()
' Update value to Quantity in tbl_Multipliers
Dim dbs As Database
Dim tbl_Multipliers As Recordset
Dim a, b, c, strSQL As String
Dim d As Integer
' Return reference to current database.
Set dbs = CurrentDb
' Create SQL string.
' strSQL = "UPDATE tbl_Multipliers SET tbl_Multipliers!Quantity =
'Forms!frm_Multipliers!ANB_Qty.Text'" _
& "WHERE tbl_Multipliers!Parent = 'CoSE001' AND
tbl_Multipliers!Component = 'CoSE003'"
strSQL = "UPDATE tbl_Multipliers SET QUANTITY =
frm_Multipliers!ANB_Qty.Text " _
& "WHERE PARENT = 'CoSE001' AND COMPONENT = 'CoSE003'"
dbs.Execute strSQL
' b = "SELECT tbl_Multipliers!PARENT' FROM tbl_Multipliers WHERE "
' c = "tbl_Multipliers!COMPONENT"
' Run action query.
MsgBox ("ANB_Qty.Text = " & d)
' Return number of records updated.
Debug.Print dbs.RecordsAffected
Set dbs = Nothing
End Sub