Gustav Brock
gustav at cactus.dk
Fri Nov 14 07:38:38 CST 2003
Hi Virginia
Well, how about uncommenting that error line and debug the criteria
and the output of DCount:
Rem On Error Resume Next
Debug.Print stLinkCriteria
Debug.Print DCount("FailureReportNo", "tblSystemMain", stLinkCriteria)
/gustav
> I tried that already, & it still opens a blank form.
> Virginia
> -----Original Message-----
> From: Andy Lacey [mailto:andy at minstersystems.co.uk]
> Sent: Friday, November 14, 2003 6:09 AM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Don't Open Form
> 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