Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2010

    Unanswered: Date syntax question

    I have the following code that populates fields in a hidden form, getting info from 2 places - a main form RequestResp2611(which is open at the time) and it's subform RQTsfApp2611 (which is also open) -

    Private Sub Form_Current()
    Me.STATLU = [Forms]![RequestResp2611]![STATLU]
    Me.DATE = [Forms]![RequestResp2611]![RQTsfApp2611]Form!MGRDATE
    Me.SLU = [Forms]![RequestResp2611]![RSLMNRQT]
    Me.SLU2 = [Forms]![RequestResp2611]![RSLMNRQT2]
    End Sub

    I made my tables long ago and called the field DATE - which I know can get tricky, but I've built way too far in before I realized and have not run into problem until now

    This hidden form has both gotten an error, and gotten through on the Date

    I think it's because I don't have syntax correct
    Me.DATE and
    MGRDATE are both date/time fields

    MGRDATE is in the subform

    When it does run, it is putting Now() in the Me.Date - not the MGRDATE value

    Me.DATE doesn't have a default in the underlying table or on the form

    I cannot explain why it is getting through today when last night it errored me - and I can't find my note on exactly what error it was.

    Is there another way I could write the Me.DATE line so that it populates with my subform value of MGRDATE? The subform requeries before it gets to the hidden form.

    Happy Holidays everyone and thank you in advance!!

  2. #2
    Join Date
    Oct 2009
    It is best to change the name of the field from "Date" to something else...otherwise, maybe try changing me!Date to [Forms]![MyForm]![Date]? Or use the name of the text box instead of the data field name.

  3. #3
    Join Date
    May 2005
    Nevada, USA
    Provided Answers: 6
    If that's a copy/paste, you missed a period:

    Me.DATE = [Forms]![RequestResp2611]![RQTsfApp2611].Form!MGRDATE

  4. #4
    Join Date
    Mar 2009
    Provided Answers: 15

  5. #5
    Join Date
    Dec 2003
    Dallas, TX


    Quote Originally Posted by pbaldy View Post
    If that's a copy/paste, you missed a period:

    Me.DATE = [Forms]![RequestResp2611]![RQTsfApp2611].Form!MGRDATE
    You can't (shouldn't) name a field the same as an Access Reserved name.
    Try making it something like....Me.WorkDate, Me.VacationDate. Just an example.

    Have a nice one,

  6. #6
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    as others are saying you are using a reserved word, whi8ch may or may nto cause problems. in my experience you can often wing it and get away with it as Access is very, some may argue too, forgiving

    personally Im suspicious of
    Me.DATE = [Forms]![RequestResp2611]![RQTsfApp2611]Form!MGRDATE
    I'd try
    Me.DATE = [Forms]![RQTsfApp2611]!MGRDATE
    mebbe you have to specify the top level form in an embedded form, but I don't think so
    I'd rather be riding on the Tiger 800 or the Norton

  7. #7
    Join Date
    Jun 2010
    Thank you all for these responses

    It was so far into my project when I realized I spaced it on that date field name, Access was allowing it, I was too lazy to try to fix all my queries, forms, reports.

    My bad!

    I should crack down and do it. My head won't spin forever, right?

Posting Permissions

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