Results 1 to 4 of 4
  1. #1
    laavista is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jun 2010
    Posts
    42

    set date field on form to date variable

    I need to set a date field on a form to a date variable.



    - Have sub_form called "f_Advertise subform"

    - Field on the sub_form called "PostedDate" (date, short)

    - Have a variable called "NewPostedDate", (dim as date), e.g., 07/19/2010



    I tried the following things:

    1) me.PostedDate = NewPostedDate (got error message)

    2) me.PostedDate = (# NewPostedDate #) (got error message)

    3) me.PostedDate.DefaultValue = NewPostedDate (no error message, but
    PostedDate field did not display the new date)

    4) me.PostedDate.DefaultValue = NewPostedDate (no error message, but
    PostedDate field did not display the new date)

    5) me.PostedDate.DefaultValue = NewPostedDate
    If me.Dirty=true then me.dirty=false
    (no error message, but PostedDate field did not display the new date)

    6) tried putting NewPostedDate variable as the default value in the field's property. It translated the entry as "NewPostedDate"

    Your help would be greatly appreciated!

  2. #2
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    Just reference the date on the sub-form e.g. Me.YourDateField = Me.YourSubform.PostedDate

  3. #3
    laavista is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jun 2010
    Posts
    42

    Thanks!

    You're great! Thank you so much!

  4. #4
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    YW. Glad you got it working.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Date/Time entry field on a form
    By Ted C in forum Forms
    Replies: 1
    Last Post: 06-22-2010, 12:28 PM
  2. Replies: 10
    Last Post: 04-21-2010, 01:16 PM
  3. Replies: 9
    Last Post: 03-19-2010, 10:37 AM
  4. Replies: 4
    Last Post: 01-25-2010, 04:14 PM
  5. Replies: 1
    Last Post: 12-09-2005, 10:29 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums