Results 1 to 6 of 6

Thread: Set an object

  1. #1
    Join Date
    Feb 2002
    Location
    Lansing MI
    Posts
    9

    Unanswered: Set an object

    I have a pop-up window that I would like to have close automatically once the last field has been completed.

    In the on exit property I put this:
    Private Sub Place_Exit(Cancel As Integer)

    acDoCmd.Close acForm, "Add_a_Ride"
    End Sub

    When I exit the field I get a message that says Run Time Error 424, Object Required.

    The solution has to be simple and clearly shows my inexperience but any help is greatly appreciated.
    Thanks in advance,
    Rick O

  2. #2
    Join Date
    Nov 2001
    Posts
    336
    Try plain:

    DoCmd.Close

    HTH

  3. #3
    Join Date
    Feb 2002
    Location
    Lansing MI
    Posts
    9
    Thanks for the suggestion. Tried it and it didn't work. I got the error RunTime error 2585 "This action cant be carried out while processing a form or report event". I think it has something to do with the fact that I have the event tied to a field rather than the form properties, but that is just a SWAG.

  4. #4
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    IGelin's suggestion should work, but I have seen instances where the DoCmd.Close method does not work.

    Is this as simple as a typo:

    Do you really have

    acDoCmd.Close acForm, "Add_a_Ride" ?

    Shouldn't that be

    DoCmd.Close acForm, "Add_a_Ride" ?

  5. #5
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    Rickober,

    I guess I have never done this before because I just replicated your problem--and it is a problem.

    I'll look at it tonight.

    Ken

  6. #6
    Join Date
    Feb 2002
    Location
    Lansing MI
    Posts
    9
    Ken.
    Thanks for your help and looking at this problem. I got the desired effect by putting DoCmd.Close in the afterinsert property on the form itself. Works perfectly.... What's that they say about skinning cats??
    Best regards,
    Rick

Posting Permissions

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