Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2003
    Location
    Middle Canada
    Posts
    1

    Red face Unanswered: How to Date-Autofill a 2nd Field when 1st Field "true"

    Howdy... how do I get the date to auto-fill in 1st field, when my user clicks yes radio button (true value) in the 2nd field?

    I want to capture the date/time the user clicked "yes", and make it part of the record to serve up for display on a different asp page. (So it doesn't *have* to appear instantly on the asp page the user is editing. - Just so long as it gets back to the database to update the record.) Make sense?

    There's got to be a way Access can handle that.... I just don't know it.

  2. #2
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    574
    On a form, I would put an event behind OnChange:

    if isnull(TheDate) then TheDate = Date

    Can you create this form then save it as an asp page and see how it converts it (if it even will)?

  3. #3
    Join Date
    Dec 2002
    Location
    Columbus, GA
    Posts
    81
    You can use a macro usig the SETVALUE command. On the check box, in the ON CLICK area, choose that macro. When they check the box, it will set the date.

    On that macro, you may want to say in the conditions tab

    if(CHECKMARKFIELDNAME is Yes,True,False)

    What this does is only sets the date if that check mark is actually checked. Otherwise, it would set the date anytime the box is checked, even if it was unchecked.

    The exact macro would be

    ACTION= SetValue
    SETVALUE ITEM = DatefieldName
    SETVALUE EXPRESSION = CurrentDate() (this is todays date)
    CONDITION = if(CHECKMARKFIELDNAME is Yes,True,False)

  4. #4
    Join Date
    Nov 2002
    Posts
    49

    Re: How to Date-Autofill a 2nd Field when 1st Field "true"

    Originally posted by dbsandwich
    Howdy... how do I get the date to auto-fill in 1st field, when my user clicks yes radio button (true value) in the 2nd field?

    I want to capture the date/time the user clicked "yes", and make it part of the record to serve up for display on a different asp page. (So it doesn't *have* to appear instantly on the asp page the user is editing. - Just so long as it gets back to the database to update the record.) Make sense?

    There's got to be a way Access can handle that.... I just don't know it.
    I think what you are looking for is something like the following:

    Private Sub Option1_click()
    If option1 then
    'this is for a true value for option1
    txtDate=date(now)
    else
    'use only if you want to clear the date in
    'the event the user changes the value to
    'False
    txtDate=null
    end if
    End Sub

    Then you can deal with the ASP page (something I have no experience with--Sorry) based on the value of txtDate.

Posting Permissions

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