Results 1 to 9 of 9
  1. #1
    Join Date
    Mar 2004
    Location
    Canada
    Posts
    47

    Unanswered: Displaying the Date

    I'm guessing I'm doing something wrong here, but i can't see what....

    I have 2 subforms (see picture) and I just want to default todays date into the 'Date Received' field on the subform. I've tried setting the default value to Date () but that doesnt seem to work. Neither did using the date field on the main form (you can see that in the upper right) which is =Format(Date(),"Short Date")

    Any ideas?
    Attached Thumbnails Attached Thumbnails dateprob.gif  
    Last edited by Anduril; 03-29-04 at 18:07.

  2. #2
    Join Date
    Feb 2004
    Location
    Dorset UK
    Posts
    147
    Have you tried

    now()

    That works for me.

  3. #3
    Join Date
    Mar 2004
    Location
    Canada
    Posts
    47
    Originally posted by Ken_Hart
    Have you tried

    now()

    That works for me.
    now() didnt work either

  4. #4
    Join Date
    Dec 2003
    Posts
    268

    What Error are you getting

    What type of error are you getting. You should be able to set the default value of the box to
    format(now(),"short date") with no problems.

  5. #5
    Join Date
    Mar 2004
    Location
    Canada
    Posts
    47

    Re: What Error are you getting

    Originally posted by mjweyland
    What type of error are you getting. You should be able to set the default value of the box to
    format(now(),"short date") with no problems.
    I dont get an error, I just dont get a Date displayed, the field remains blank.

    Private Sub POQtyRec_GotFocus()
    If IsNull(Me![PODateRec]) Then
    Me![PODateRec] = Date
    End If
    End Sub

    I have forced a value into the field now using the above in the on-focus event for the Qty Received field, this does work

  6. #6
    Join Date
    Dec 2003
    Posts
    268

    Default value

    So for the default value for the text box control you have set it to the code I supplied and you aren't getting anything in the box at all?

  7. #7
    Join Date
    Mar 2004
    Location
    Canada
    Posts
    47

    Re: Default value

    Originally posted by mjweyland
    So for the default value for the text box control you have set it to the code I supplied and you aren't getting anything in the box at all?
    If I set the control box text, yes it will display, but then it is no longer a 'data field' for the file it is coming from, so the value does not get written to the file.

    Thats why I have been using the 'default' value to try and force a value that way.....

  8. #8
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    so you need some sort of event to stuff the date into your field.


    private somethingOnYourMotherForm_AfterUpdate()
    me!yourSubform.theReluctantDateBox = theWorkingDateBox ' or now()

    - or -

    private yourSubform_Load()
    theReluctantDate = forms!theMotherForm.theWorkingDateBox ' or now()


    izy
    currently using SS 2008R2

  9. #9
    Join Date
    Dec 2003
    Posts
    138
    have you tried

    Today()

Posting Permissions

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