Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2005
    Posts
    313

    Unanswered: Before Update Event

    Hi,

    In Form of the MS Access.

    How can I make the form cannot close if the field is Null when I click the close button?

    frm1:
    Field Name: Date, Id, Name

    The 3 field names are required to input.

    Before Update Event:
    if (isnull(date)) then
    date.setforce
    end if
    if (isnull(id)) then
    id.setforce
    end if
    if (isnull(name)) then
    name.setforce
    end if

    It works well when I go to next record (suppose I miss one field)
    However, It doesn't work when I click the close button, the form is closed.
    I want the form cannot close until fill out all fields. It cannot go to the missing fields.

    I have a question, when I click close button, Must the form be closed even though I set up the field to be "setforce"?

    Thanks.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    read up on the before update event, and for that matter other events.

    if you set cancel = true then Access will not write the values in the before update event

  3. #3
    Join Date
    Jan 2006
    Posts
    1

    Close Form

    Or you could put code in the Close event of the form.

Posting Permissions

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