If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > iif expression with date

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-03-11, 12:58
MMontoya MMontoya is offline
Registered User
 
Join Date: Oct 2011
Posts: 4
iif expression with date

I would like to know if there is a way to use the expression:

=iif([Order Sent]=yes,date(),null) can work by keep the date as the original date the order was sent, and not keep populating current date as days go by.

This expression is in a text box in a form. The Order Sent is a check box in that same form. They are both fields in the same table. The goal is to check the order sent box and auto populate what day it was sent, and when the product is received, to just uncheck the order sent box, and the date will go away.

Thanks in advance
Reply With Quote
  #2 (permalink)  
Old 10-03-11, 13:19
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
iif sounds like an Access VBA construct
do you want this question moving to another, hopefully relevant, forums where you are more likely to get an answer
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 10-03-11, 13:25
MMontoya MMontoya is offline
Registered User
 
Join Date: Oct 2011
Posts: 4
That would be fine. How do I do that?
Reply With Quote
  #4 (permalink)  
Old 10-03-11, 14:16
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
probably the best way to approach this is to, say, have a button whiuch the user presses to indicate the order is shipped. and attach some code behind that button that sets the ship date, or allows the user to set a shipdate.
then lock the button in futures so users cannot set a new ship date AND cannot edit the ship date

so it comes down to you, do you want to allow your users to set shipping date or do you only want set the ship date based on the current date?

you can lock the button on the basis of the shipping date column
if there is a valid date in shipdate then disable the button. put soem code in the forms on current event. eg:-

Code:
if (isdate(mydatecontrol)) = true then 'test to see if there is a valid date in shipdate
  mybuttoncontrol.enabled = false 'if there is a valid date then disable the button
else
  mybuttoncontrol.enabled = true 'otherewise disable the button so a user cannot set another shipping date
endif
this can be rewritten to simplfy the logic
Code:
mybuttoncontrol.enabled = NOT isdate(mydatecontrol)
functionally its the same as above but expresses it as a single statement. note you may need to check for null values.

how you handle users addign dates other than today I'll leave up to you. ytou could use a modal dialog, you could use the button to display a date picker control set the default value to today, and set the value of shipping date assuming the user selects a date. if a date is selected then disable the button . you need to work out a strategy to lock the shipping date control so a user cannot edit the date once set
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #5 (permalink)  
Old 10-03-11, 14:51
MMontoya MMontoya is offline
Registered User
 
Join Date: Oct 2011
Posts: 4
Thanks, I will give it a try.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On