Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update question

Status
Not open for further replies.

jehm

Technical User
Jan 16, 2006
2
BG
I want to set the field Suborder from the table orders to true when i issuing an order.In my main form
i have a control with the following code

If Me!ChkSubOrder = True Then
strSQL = "UPDATE orders SET Suborder = True WHERE orderid= Me!orderid FROM orders)"
End If


However the field for the relevant order is not set to True.I must have an error in my code.Could you help me ?
 
Here is the correct Code...

Code:
If Me!ChkSubOrder = True Then
strSQL = "UPDATE orders SET Suborder = True WHERE orderid = " & Me!orderid
End If

Alternatively You can just bind the ChkSubOrder to Suborder
It will automatically update without any coding
i.e., make Suborder as controlsource for ChkSubOrder

Hope this helps...
Regards,
 
oh in the above post there is one line of code left out

Here is the revised code

Code:
If Me!ChkSubOrder = True Then
     strSQL = "UPDATE orders SET Suborder = True WHERE orderid = " & Me!orderid
     DoCmd.RunSQL strSQL
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top