Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2011
    Posts
    4

    Unanswered: 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

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    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 on the Tiger 800 or the Norton

  3. #3
    Join Date
    Oct 2011
    Posts
    4
    That would be fine. How do I do that?

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    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 on the Tiger 800 or the Norton

  5. #5
    Join Date
    Oct 2011
    Posts
    4
    Thanks, I will give it a try.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •