🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.databases.ms-access
Article #366

Re: Best way to prevent report from printing until conditions met?

#366
From: Allen Browne
Date: Tue, 02 Feb 1999 00:00
50 lines
2543 bytes
Use the report's Open event. You can set it's Cancel argument to True
to prevent the report opening until the info is present.

The code will be something like this:
--------------------------------------------
Dim strForm as String   ' Name of the form 
Dim frm as Form         ' Reference to the form.

strForm = "Whatever You Called Your Form Goes Here"

' Make sure the form is open.
If SysCmd(acSysCmdGetObjectState, acForm ,strForm) = conObjStateClosed
Then
    DoCmd.OpenForm strForm
End If

' Make sure the 3 fields are filled in.
Set frm = Forms(strForm)
If IsNull(frm![DateOfBirth]) Or IsNull(frm![WorkTele]) Or
IsNull(frm![Control]) Then
    Cancel = True
    MsgBox "Some stuff is missing.", vbExclamation, "Required"
    frm.SetFocus
End If
Set frm = Nothing
--------------------------------------------

howg wrote:
> 
> Would like to prevent a report from printing until all conditions are met
> with respect to specific textboxes.
> 
> Once the following fields have value allow then allow the report to print.
> If value IS
> missing then pop-up form appears with message telling user to add the
> information before
> the report can print.  The pop-up form should have a close/cancel button.
> 
> [control]
> "message to pop-up"
> ---------------------
> [DateofBirth]
> "Enter the applicants Date of birth to continue."
> [WorkTele]
> "Enter the applicants Work Telephone number to continue."
> 
> I would like to do with vba code.
> 
> Can anyone get me started, refer me to book sample, refer me to db sample,
> or whatever?
Technical Details
Message-ID: <36B65E1C.7D415FD0@odyssey.apana.org.au>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <794gik$k68$1@ash.prod.itd.earthlink.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111a5a,2593932dec0d90d
X-Google-Attributes: gid111a5a,public
X-Google-Thread: ff0ac,2593932dec0d90d
X-Google-Attributes: gidff0ac,public
X-Google-Thread: f8db2,2593932dec0d90d
X-Google-Attributes: gidf8db2,public
X-Google-Thread: f87f8,2593932dec0d90d
X-Google-Attributes: gidf87f8,public
From: Allen Browne <abrowne@odyssey.apana.org.au>
Subject: Re: Best way to prevent report from printing until conditions met?
Date: 1999/02/02
Message-ID: <36B65E1C.7D415FD0@odyssey.apana.org.au>
X-Deja-AN: 439595294
Content-Transfer-Encoding: 7bit
References: <794gik$k68$1@ash.prod.itd.earthlink.net>
To: howg <howg@earthlink.net>
Content-Type: text/plain; charset=us-ascii
Organization: APANA Western Australia (http://www.wa.apana.org.au/)
Mime-Version: 1.0
Newsgroups: comp.databases.ms-access,es.comp.bd.ms-access,it.comp.database.access,microsoft.public.excel.programming