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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UPDATE clause with Multiple WHERE criteria?

Status
Not open for further replies.

firebirdta84

Technical User
Aug 23, 2007
56
US
Hey everyone,

I have a table named tbl_Master_BE with three fields - CaseNumber, FieldType and AssignedTo. Right now, I have code that fills in the AssignedTo field with a user's name for "X" number of records (that they choose from a drop-down box). If the AssignedTo field is already filled in, then the code skips that line. Here's the code:

DoCmd.RunSQL "Update (Select top " & Combo58 & " * From tbl_Master_BE where AssignedTo is null order by ID) dt Set AssignedTo ='" & Text60 & "'"

Here's my question - I want to add a second criteria to the where clause....so not only does the AssignedTo field need to be null, but the FieldType field must equal what is chosen in a combo box on a form (we'll call is Combo1). Is this possible? Any help would be appreciated!

Thanks.
 
DoCmd.RunSQL "Update (Select top " & Combo58 & " * From tbl_Master_BE where AssignedTo is null and FieldType='" & Combo1 & "' order by ID) dt Set AssignedTo ='" & Text60 & "'"

If FieldType is defined as numeric then get rid of the single quotes.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top