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

Loop through a datasheet and change cell value based on two other cells

Status
Not open for further replies.

scubafrog79

Programmer
Oct 10, 2014
13
0
0
US
I have a form that is shown as a datasheet view when it's loaded. During the loading of the form, I would like for it to do a "calculation" that if the "Refill Date" is greater than the "PA Date", it changes the "PA Required" to TRUE. But I need it to check all the rows as the form loads. I should add that I don't want to save the change to PA Required in the table that stores the data, just want it to show me when the form loads. How can I do this with VBA code?

Datasheet_fvvbww.png


Thank you in advance
 
How about simple:
[tt]
Select "Refill Date",[blue]
IIF("Refill Date" > "PA Date", TRUE, FALSE) As "PA Required",[/blue]
"PA Date"
From MyTable
[/tt]


---- Andy

There is a great need for a sarcasm font.
 
Hi Andy,
This is MS Access so they syntax would be:

SQL:
Select [Refill Date],
IIF({Refill Date} > [PA Date], TRUE, FALSE) As [PA Required],
[PA Date]
From MyTable

At least you didn't use CASE WHEN in place of IIf.

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
Shouldn't [pre]{Refill Date}[/pre] be [pre][Refill Date][/pre] ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top