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:
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.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
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.
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
Alan
Click the * below to say thanks.
Database Principles
Pivot Table Tips
Good Excel Video Tutorials
Sumifs or SumProduct
DataPig Access Tutorials
MS Query Tutorial
Worst Pie Chart Ever?
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.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks