Expression Help

  • Thread starter Thread starter Ted
  • Start date Start date
T

Ted

I am writing an update query...or trying to at least. I
want it to update the record if the difference between the
net date and the {Enter Date] is greater than or equal to
31 and less than 61. Below is my expression:

IIf(CDate([Enter Date])-[Net Date]>=31<61,"Over 30")

My problem is that it is updating records that have a date
difference of 1-30 days.

Any quidance would be appreciated.
 
Ted,

You need a form with a command button to run the update query. Make the form a
pop-up form and name it PFrmUpdate. Put an unbound textbox on the pop-up form to
enter the "Enter Date" and name it MyDate. In a blank field in your query, put
this expression:
DaysElapsed: DateDiff("d", [Net Date], Forms!PFrmUpdate!MyDate)
Put this expression in the criteria of that field:
=31 and <61
Change the query to an update query.
In the field you want to update, put this expression where it says update to:
"Over 30"

Put the following code in the OnClick event of the command button on your form:
DoCmd.SetWarnings False
DoCmd.OpenQuery "NameOfYourUpdateQuery"
DoCmd.SetWarnings False


--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com



Ted said:
I am writing an update query...or trying to at least. I
want it to update the record if the difference between the
net date and the {Enter Date] is greater than or equal to
31 and less than 61. Below is my expression:

IIf(CDate([Enter Date])-[Net Date]>=31<61,"Over 30")

My problem is that it is updating records that have a date
difference of 1-30 days.

Any quidance would be appreciated.
 
Back
Top