+ Reply to Thread
Results 1 to 3 of 3

Thread: Wierd open form behavior

  1. #1
    Registered User
    Join Date
    11-07-2008
    Location
    St. Louis, Missouri, USA
    MS-Off Ver
    2003
    Posts
    50

    Wierd open form behavior

    I have a subform on my main data entry form that is opened with a command button. It's the form where I keep track of surgery cases I need to enter into the database. I call it my "Radar". The form is frmNewCases. The name of the command button is objRadar.

    I want the subform to open to a specific size and a specific place on the screen. I have an "on click" event procedure with the following code:
     Private Sub objRadar_Click()
    On Error GoTo Err_objRadar_Click
    
        Dim stDocName As String
        
        stDocName = "frmNewCases"
        
        DoCmd.OpenForm stDocName
        DoCmd.MoveSize 2000, 4400, 9000, 5000
        
    Exit_objRadar_Click:
           Exit Sub
    
    Err_objRadar_Click:
        MsgBox Err.Description
        Resume Exit_objRadar_Click
    The trouble is, when the data entry form is first opened and I click on the command button for the first time, the subform always opens maximized. When I close the subform and click the button again, the subform opens the way I wanted it.

    I can't understand why the subform always opens maximized the first time the command button is clicked, but behaves normally after that.

    By the way, I don't want the subform to open as a dialog box because I'm constantly working between the subform and my main data entry form, so I don't want to constantly click to close the subform. Otherwise I would use the windowMode "acDialog".

    And I just realized I spelled weird wrong.
    Last edited by Research RN; 03-01-2011 at 02:41 PM.

  2. #2
    Valued Forum Contributor alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Lake County, Illinois
    MS-Off Ver
    MS Office 2010, 2007 and 2002
    Posts
    1,155

    Re: Wierd open form behavior

    Check on what MS has to say about setting the size and see if this makes a difference.

    http://office.microsoft.com/en-ca/ac...005187660.aspx

    Also, look at this thread and see if it helps you.

    http://www.access-programmers.co.uk/...d.php?t=118486

    Alan

  3. #3
    Registered User
    Join Date
    11-07-2008
    Location
    St. Louis, Missouri, USA
    MS-Off Ver
    2003
    Posts
    50

    Re: Wierd open form behavior

    Alan, Thanks for your reply. The code I've written works. It just doesn't work the first time the command button is clicked. It works every other time, just not the first time. For the life of me I don't know why this is happening. If the button runs the same code every time it is clicked, why the two different behaviors.

    The code you posted is way more than I need, but I'll keep it in my files just in case. Thanks again.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.2.0