Hollis,Virginia
HollisVJ at pgdp.usec.com
Thu Jan 30 08:38:00 CST 2003
That did not work, it still tries to open the frmSystemFailure. I commented out the SetFocus statement on the form & the form opens to a blank form. Virginia -----Original Message----- From: Mike and Doris Manning [mailto:mikedorism at ntelos.net] Sent: Thursday, January 30, 2003 8:13 AM To: accessd at databaseadvisors.com Subject: RE: [AccessD] Don't Want form to open Solution: If DCount("EngineerID", "tblEngineer", stLinkCriteria) > 0 Then... Doris Manning Database Administrator Hargrove Inc. www.hargroveinc.com -----Original Message----- From: accessd-admin at databaseadvisors.com [mailto:accessd-admin at databaseadvisors.com] On Behalf Of Hollis,Virginia Sent: Thursday, January 30, 2003 08:56 AM To: 'accessd at databaseadvisors.com' Subject: [AccessD] Don't Want form to open I have been off the list for awhile - you sure have gotten fancy with subscribing the last few months!! *********** Problem: I have a form that users select their name from a combobox, it opens a main form that allows them to edit only active requests. I am having problems with the main form opening even if they do not have any active requests (they are closed). If they do not have any active requests, the message box "No Open EFRs" should display, but it doesn't, the frmSystemFailure opens & I receive an error, can't go to specified record (on the main form OnOpen, I have it set focus to a certain field). How can I prevent the frmSystemFailure from opening & display the message? UserID is the name of the combobox. 'Status is Pending, In Progress, or In Review, and User ID = Engineer ID 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("EngineerID", "tblEngineer", stLinkCriteria) Then DoCmd.OpenForm stDocName, , , stLinkCriteria Else 'Display Message "No open EFRs" MsgBox "No open EFRs for " & Forms![frmUpdateEFRs]![UserID].Column(1) End If ' Close the dialog box. DoCmd.Close acForm, "frmUpdateEFRs" -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030130/30c69fbd/attachment-0002.html>