Results 1 to 2 of 2

Thread: Time/Date query

  1. #1
    Join Date
    Feb 2002

    Unanswered: Time/Date query

    I wonder if there's somebody who can help me with this. I have never used MS Access before and I'm trying to learn queries.

    My question is:

    I got start date and stop date and I want the query to find how many days there are between these two days.
    The startdate is a value in a column in a table, and I have to fill in the stop date in the query.

    It may be easy for you but for me...

    Thanks for any reply...

    Jan Iversen

  2. #2
    Join Date
    Nov 2001

    1. Here is a simple example how to calculate the difference between two dates:

    Select StartDate, StopDate, DateDiff("d",StopDate,StartDate) as ElapsedDays From MyTable;

    2. You can use Update query to to fill in the stop date. Example:

    Update tblMyTable Set StopDate = #1/1/2002# Where State='MA';

    in the code it'll look like this:

    strSQL = "Update tblMyTable Set StopDate = #" & me.txtStopDate & "# Where State='" & me.cboState & "';"

    ' where txtStopDate and cboState are textbox and combobox on your holding the parameters for your query.

    currentdb.execute strSQL

Posting Permissions

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