Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Error message (Access 97)

    I have a cmd button that closes the form it is on and then opens a second form. When I use the button every thing seems to work as expected but I get the following message: The expression you entered refers to an object that is closed or doesn't exist.

    I am using the following code
    Private Sub cmdLocation_Click()
    On Error GoTo Err_cmdLocation_Click
    DoCmd.Close
    DoCmd.OpenForm "frmLocation", acNormal
    DoCmd.MoveSize 3500
    Me.InsideWidth = 2.5 * 1440
    Me.InsideHeight = 1.5 * 1440
    Exit_cmdLocation_Click:
    Exit Sub

    Err_cmdLocation_Click:
    MsgBox Err.Description
    Resume Exit_cmdLocation_Click

    End Sub

    I can't see anything in this code that would cause a problem. Once I clear the message the form works as it should. I don't see any code in the opening even of the opening form to cause the problem.

    Thanks Fay

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Error message (Access 97)

    "Me" refers to the object that is executing the code, i.e. the form you have just closed. You can't use "Me" to refer to another form that you have opened.

    You can either use DoCmd.MoveSize to move AND resize frmLocation, or you must refer to frmLocation instead of "Me":

    With Forms!frmLocation
    .InsideWidth = 2.5 * 1440
    .InsideHeight = 1.5 * 1440
    End With

  3. #3
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Error message (Access 97)

    Once again I thank you. It worked great. Fay

Posting Permissions

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