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

Update to Yes/No field not working

Status
Not open for further replies.

Fozzy9767

Technical User
Jun 12, 2006
58
US
I have a table I am trying to do some mass updates to. It has an ItemID field and a Yes/No field. I am trying to set the Yesy/No field to Yes where ItemID is one os several values. The update query runs with no errors but doesn't affect the table at all. Here is my code:
Code:
UPDATE AgentItem SET AgentItem.Use = Yes
WHERE ((("ItemID") Between "1" And "12" Or ("ItemID") Between "21" And "25" Or ("ItemID") Between "28" And "32" Or ("ItemID") Between "34" And "36" Or ("ItemID") Between "39" And "47" Or ("ItemID") Between "51" And "55" Or ("ItemID")="67" Or ("ItemID")="71" Or ("ItemID") Between "75" And "95"));

I must be missing something simple. Can someone please point it out to me? Thanks, Ken.
 
[ItemID] instead of ("ItemID") ?

~Melagan
______
"It's never too late to become what you might have been.
 
Well, that gets me an "Data Type MisMatch" error.
 
If ItemID is defined as numeric:
UPDATE AgentItem SET AgentItem.Use = True
WHERE ItemID Between 1 And 12 Or ItemID Between 21 And 25 Or ItemID Between 28 And 32 Or ItemID Between 34 And 36 Or ItemID Between 39 And 47 Or ItemID Between 51 And 55 Or ItemID=67 Or ItemID=71 Or ItemID Between 75 And 95

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I created this table with a query. ItemID is a Primary key in another table that is set as an autonumber. I just checked my agentitem table and is brought that field over as is, it's set as an autonumber field and I don't think I want it that way. Can I just change this to another numeric type? It's not a unique field in this table.
Ken
 
The quotes are evil!!! Worse yet, I typed them in myself. Thanks PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top