Results 1 to 11 of 11

Thread: Date

  1. #1
    Join Date
    Jul 2002
    Posts
    35

    Unanswered: Date

    I'll try to make this as simple as possible.

    I created a form.
    There is a text box that is linked to a table. The table has a list of dates.

    What I need is, when the form opens, to lookup the date values in the table and display today's date.

    Example: I open the form today, the date in the text box will be 12/18/02. Tomorrow when I open the form it would look up the value 2/19/02.

    Any suggestions?

  2. #2
    Join Date
    Nov 2002
    Location
    Hillsboro, OR, USA
    Posts
    59

    Re: Date

    Set the Default Value of the text box to Date()

  3. #3
    Join Date
    Jul 2002
    Posts
    35
    I did as you wrote, but it did not work.

    I already have the date values in a table. I just want the current date value to be displayed. The date is not going to be entered.

  4. #4
    Join Date
    Nov 2002
    Location
    Hillsboro, OR, USA
    Posts
    59
    Set the Filter property to:
    Code:
     "YourDate=" & Date()
    or set the recordsource of the form to:
    Code:
     SELECT * YourTable WHERE YourDate = Date()
    Last edited by bri; 12-18-02 at 18:57.

  5. #5
    Join Date
    Sep 2002
    Location
    Land of OZ
    Posts
    173
    this should be added to tyhe default value property Date()


    Originally posted by parra
    I did as you wrote, but it did not work.

    I already have the date values in a table. I just want the current date value to be displayed. The date is not going to be entered.
    Mona
    ________________________________
    Life is too short to be sane or sensible. Weird people rule and normal people suck

  6. #6
    Join Date
    Jul 2002
    Posts
    35
    Hi Bri, what could I be doing wrong?

    I added this:
    Date= & Date()[\code]
    to the forms filter properties. I closed and opened the form & database and it did not work.

    I am sure you understand what I am trying to accomplish.

    Any suggestions?
    Thanks

  7. #7
    Join Date
    Nov 2002
    Location
    Hillsboro, OR, USA
    Posts
    59
    After setting the Filter property to:
    Code:
     "YourDate=" & Date()
    Click the Filter button in the toolbar (the funnel icon)

    If this works then add this to your forms OnLoad event.

    Code:
       me.FilterOn = True

  8. #8
    Join Date
    Jul 2002
    Posts
    35
    I saw the filter icon in a query window
    but not in the
    Form design window.

    The form is not running off a query but rather from a table directly. Could this effect what I am trying to do?

  9. #9
    Join Date
    Nov 2002
    Location
    Hillsboro, OR, USA
    Posts
    59
    The filter button should be available in form view and data sheet view but not in any design view. If it is not there, right-click on a blank space on the toolbar and select Form View.

    Filters will work on a tables.

    The filter syntax may need to look like this:

    Code:
    "YourDate=#" & Date() & "#"

  10. #10
    Join Date
    Nov 2002
    Location
    Hillsboro, OR, USA
    Posts
    59
    Is your field really named "Date"?
    That could be causing problems since "Date" is also the name of the function you are trying to call. Name the field something a little more specific like InvoiceDate or whatever. Of course any code you have written referring to the field "Date" will need to be updated when you make this change.

  11. #11
    Join Date
    Jul 2002
    Posts
    35
    OK I got it now, Thanks Bri.

Posting Permissions

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