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 Query Expression Help Needed!

Status
Not open for further replies.
Mar 19, 2002
18
US
Hi - I have a database built and I am building an "Update Query" in design view. I want one particular field of my database to be changes to and "Inactive" status if the date field is greater than 7 days old.

In the query design view, I need help with the "criteria" or expression section. I'm not sure how to create the expression to do this.

Any help would be appreciated.

David
 
In the "Update to:" for the specific field you're wanting to update, use the following base coding:

IIf(DateDiff("d",[NameOfDateField],Date())>6,"Inactive",[NameOfDateField])

No Criteria is needed for this type of query. Just use this coding - this locks up the table while running because it looks at each record.

However, if you wish, you could "Update to:" to be "Inactive", set the name of the Date field to:

Expr1: DateDiff("d",[NameOfDateField],Date())
Criteria: >6

HTH
Roy
aka BanditWk
Las Vegas, NV
roy@cccamerica.org
RLMBandit@aol.com (private)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top