[AccessD] Don't Open Form

Stuart Sanders stuart at pacific.net.hk
Fri Nov 14 07:42:53 CST 2003


You get a blank form if the underlying record source is empty.  As Andy
mentioned, you need to test for the recordcount and if 0 warn the user and
either don't open the form, or if the test is in the form itself close
gracefully.

Alternatively you could go the main/subform approach, where the main form uses
the userid and the subform lists all open documents with the userid.

Stuart

> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
> Hollis,Virginia
> Sent: Friday, 14 November, 2003 9:19 PM
> To: 'Access Developers discussion and problem solving'
> Subject: RE: [AccessD] Don't Open Form
>
>
> 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
>
> _______________________________________________
> 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
>
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>




More information about the AccessD mailing list