Hollis,Virginia
HollisVJ at pgdp.usec.com
Fri Nov 14 07:17:15 CST 2003
Sorry about that - typo on the query. I set the query EngineerID = frmUpdateEFR.EngineerID frmUpdateEFR is the form with the combobox for selecting the Engineer's name to open frmSystemFailure and view the open EFRs. Totally confused yet? Virginia -----Original Message----- From: Hollis,Virginia Sent: Friday, November 14, 2003 7:15 AM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] Don't Open Form I tried making a query & using this code. In the query I set the StatusID to show only open & EngineerID = Forms!frmSystemFailure.EngineerID. If there are not any open EFRs for the Engineer, the message box shows, but I get an error, that it can't find frmSystemFailure. Function NoOpenEng() If DCount("*", "qryStatusEng") > 0 Then 'gives the number of records returned by the query DoCmd.OpenForm "frmSystemFailure", acNormal, "qryStatusPendingEng", Forms!frmUpdateEFRs.UserID = Forms!frmSystemFailure.EngineerID, acFormEdit, acWindowNormal Else MsgBox "No Open EFRs" End If End Function -----Original Message----- From: Hollis,Virginia [mailto:HollisVJ at pgdp.usec.com] Sent: Friday, November 14, 2003 7:02 AM To: 'accessd at databaseadvisors.com' Subject: [AccessD] Don't Open Form I have the below code on a form that is used to open another form filtered to the selected Engineer's name. The user selects their name from a combobox (UserID), if the document status is open, or pending, or in progress, the frmSystemFailure opens filtered to show their open documents. If there are not any open EFRs for the selected Engineer, the form is still opening, but it is blank. It is not giving the MsgBox, No Open EFRs.... What is wrong that the form is opening blank instead of giving the MsgBox? Virginia stDocName = "frmSystemFailure" stLinkCriteria = "[EngineerID]=" & Me![UserID] & " AND [StatusID] = 1" & _ "Or [EngineerID]=" & Me![UserID] & " AND [StatusID] = 2" & _ "Or [EngineerID]=" & Me![UserID] & " AND [StatusID] = 4" ' Check whether the user has any EFRs open. If they do, open the ' form with a filter. On Error Resume Next If DCount("FailureReportNo", "tblSystemMain", stLinkCriteria) Then DoCmd.OpenForm stDocName, , , stLinkCriteria Else 'DisplayMessage "No open EFRs" MsgBox "No open EFRs for " & Forms![frmUpdateEFRs]![UserID].Column(1) End If _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com