Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Posts
    1

    Unanswered: How to use answer from date prompt in calculated field...

    Hello,
    I want to write a query on a warranty database to figure out how many days are left on a unit's warranty based on a future date.

    For example, if a unit shipped on 1/1/04 and the warranty is 365 days, how many days are left on the warranty as of 3/31/04?

    I want to prompt the user for the date to compare to,
    then use that date to calculate how many days are left.

    I got it to work just comparing to today's date(DATE()), but I can't get it to work using the prompted date field. So I have the calculated fields:

    DATE PROMPT: [CDate()]

    DAYS LEFT: [WARRANTY END DATE]-[DATE PROMPT]

    IN OR OUT: IIf([DAYS LEFT]>0,"IN","OUT"

    I do get prompted for the date, but the when the query runs I get ERROR for the DAYS LEFT and IN OR OUT fields.

    I guess I am not using the right syntax to be able to use the answer from the date prompted.

    Any help is appreciated greatly!

    -Laura

  2. #2
    Join Date
    Mar 2004
    Posts
    77
    if you are using input boxes to prompt for the date, then try this:

    Dim date_prompt as string
    Dim days_left as string

    date_prompt = InputBox(your_Prompt, your_Title)
    days_left = [WARRANTY END DATE]-date_prompt

    [textbox] = IIf(days_left>0,"IN","OUT")

    where [textbox] is the place where u want to show a "IN" or "OUT".

    inform me if it works.

Posting Permissions

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