Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2006
    Provided Answers: 1

    Unanswered: Me is not working on form with header

    I have a form that has a header. In the header is an unbound textbox that is used to search for a particular record. In the form properties is a BeforeUpdate sub to capture last update. The sub is:

    Private Sub Form_BeforeUpdate (cancel as integer)
    Me![DateLastUpdated].Value = Now()
    End Sub

    Everything works fine if you move to another record using PgUp/Dn or other keystrokes. However, if after you update a record, you mouseclick to the header to search for another record, the update function abends and the form does not get saved. Is there a way of triggering the sub when switching to the form header? I assumed that Me! referred to the record that was in the form regardless of whether you were in the header, detail, or footer, but apparently that is not so.

  2. #2
    Join Date
    May 2004
    New York State
    Me! in a VBA proc behind a form or report refers to the controls on the form itself. It's like saying Forms!<NameOfCurrentForm>! Ditto with reports. if you're interested in recent information, you have to either save it separately in a memory variable or search for it in a table.

    In your particular case, you might be safer using a preliminary form to find a data record, and a separate form to contain that record, update it, and process/save it. Then close the processing form and return to the preliminary form before accessing another record.


    'Abends,' eh? I haven't heard that term since 1999 when I graduated from Technology class.

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