[AccessD] Don't Open Form

Hollis,Virginia HollisVJ at pgdp.usec.com
Fri Nov 14 07:01:31 CST 2003


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



More information about the AccessD mailing list