[AccessD] Don't Open Form

Andy Lacey andy at minstersystems.co.uk
Fri Nov 14 06:09:13 CST 2003


Virginia
You need to test If DCount(etc)>0. You've omitted the >0 part.
--
Andy Lacey
http://www.minstersystems.co.uk




--------- Original Message --------
From: "Access Developers discussion and problem solving"
<accessd at databaseadvisors.com>
To: "'accessd at databaseadvisors.com'" <accessd at databaseadvisors.com>
Subject: [AccessD] Don't Open Form
Date: 14/11/03 19:04


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

________________________________________________
Message sent using UebiMiau 2.7.2



More information about the AccessD mailing list