Form no longer maximizing

Ignore any posts by Lafgura, already reported because they are SPAMMING the Forum.

Might be easier this way, copy/paste the code from both Forms here. Becuase I know this should work, I've used something very similar.
 
This is the form code for the first form that contains the buttons (frmQuickDESelect). I've removed all of the test code for cmdMtAiry_Click():


Option Compare Database

Private Sub cmdDunedin_Click()
DoCmd.OpenForm "frmQuickDE", , , "QuickDEGroup = 'Dunedin'"
End Sub

Private Sub cmdEdgerton_Click()
DoCmd.OpenForm "frmQuickDE", , , "QuickDEGroup = 'Edgerton'"
End Sub

Private Sub cmdExitQuickDEMenu_Click()
On Error GoTo Err_cmdExitQuickDEMenu_Click

DoCmd.Close

Exit_cmdExitQuickDEMenu_Click:
Exit Sub

Err_cmdExitQuickDEMenu_Click:
MsgBox Err.Description
Resume Exit_cmdExitQuickDEMenu_Click

End Sub

Private Sub cmdMtAiry_Click()
DoCmd.OpenForm "frmQuickDE", , , "QuickDEGroup = 'Mt. Airy'"
End Sub

Private Sub cmdRoosevelt_Click()
DoCmd.OpenForm "frmQuickDE", , , "QuickDEGroup = 'Roosevelt'"
End Sub

Private Sub cmdValley_Click()
DoCmd.OpenForm "frmQuickDE", , , "QuickDEGroup = 'Valley'"
End Sub

Private Sub cmdExchange_Click()
DoCmd.OpenForm "frmQuickDE", , , "QuickDEGroup = 'Exchange'"
End Sub

Private Sub cmdMcDonough_Click()
DoCmd.OpenForm "frmQuickDE", , , "QuickDEGroup = 'McDonough'"
End Sub

Private Sub Form_Activate()
DoCmd.Maximize
End Sub

Private Sub Form_GotFocus()
DoCmd.Maximize
End Sub

Private Sub Form_Load()
DoCmd.Maximize
End Sub

Private Sub Form_Open(Cancel As Integer)
DoCmd.Maximize
End Sub

Private Sub Form_Resize()
DoCmd.Maximize
End Sub

******************************
Here is the code from the second form - the quick data entry screen (frmQuickDE). The Form_Open Event has the code in it that shows the message box and leaves this form open.

Option Compare Database

Private Sub cmdQuickDEHelp_Click()
On Error GoTo Err_cmdQuickDEHelp_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmQuickDEHelp"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdQuickDEHelp_Click:
Exit Sub

Err_cmdQuickDEHelp_Click:
MsgBox Err.Description
Resume Exit_cmdQuickDEHelp_Click

End Sub

Private Sub cmdQuickDESaveRecord_Click()
On Error GoTo Err_cmdQuickDESaveRecord_Click

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Exit_cmdQuickDESaveRecord_Click:
Exit Sub

Err_cmdQuickDESaveRecord_Click:
MsgBox Err.Description
Resume Exit_cmdQuickDESaveRecord_Click

End Sub

Private Sub ExitQuickDE_Click()
On Error GoTo Err_ExitQuickDEScreen_Click

DoCmd.Close

Exit_ExitQuickDEScreen_Click:
Exit Sub

Err_ExitQuickDEScreen_Click:
MsgBox Err.Description
Resume Exit_ExitQuickDEScreen_Click

End Sub

Private Sub Form_Activate()
DoCmd.Maximize
End Sub

Private Sub Form_Close()
DoCmd.Maximize
End Sub

Private Sub Form_GotFocus()
DoCmd.Maximize
End Sub

Private Sub Form_Load()
DoCmd.Maximize
End Sub

Private Sub Form_Open(Cancel As Integer)
DoCmd.Maximize
If Me.Recordset.RecordCount = 0 Then
DoCmd.Close acQuery, "qryFrmQuickDE"
MsgBox "No records found"
End If
End Sub

Private Sub Form_Resize()
DoCmd.Maximize
End Sub
 
Wait a minute, I'm confused. I thought the Form opened then from the first Form you were trying to prevent the opening of the second Form. However, I'm not seeing that above.

You can also remove the DoCmd. Maximize from everything except the On_Load event.
 
Yes, that's what I was definitely trying to do. But all that code didn't work so I took it out as I was getting confused going back and forth.

So form one (frmQuickDESelect) has the buttons that open form two (frmQuickDE) and filter the record selection. If there are no records to pull for frmQuickDE then I would not like frmQuickDE to even open and just show the "No Records Found" message box.
 
Okay, do you have a sample file you can upload? Something with some dummy data then you can copy what I do into the *live* one.
 
Yes, here is a sample. I have removed all unneeded items. From the Main Menu, click on "Quick Data Entry." At the Quick Data Entry menu choose the "Dunedin" button to see what happens when there are related records. Choose the "Mt. Airy" button to see what currently happens when there are no related records. Thanks!
 

Attachments

Okay, did not realize you were opening the Form based on criteria. Just need to add that to the DCount(). Now, message, no Form.
 

Attachments

Users who are viewing this thread

Back
Top Bottom