Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Required Fields in a Query / Report 1

Status
Not open for further replies.

pcolvin

Technical User
Oct 17, 2008
22
US
I have a report that is run using a command button in a form. The report is populated with information from a query. Is it possible to notify the user if certains fields in the report are left blank becuase the field is null OR can the query require a user to complete null fields?

For example, the report generates a form-letter that begins with "Dear [Salutation] [First Name] [Last Name],"

The query populates the form as follows: Dear Mr. John Doe,

Let's assume the first name field was left blank.

OPTION 1
Is is possible to have a notification box pop-up that tells a user if any of the fields are null: "The first name of the client is blank, please enter the first name on the client form and try again."

OPTION 2
Is it possible to have a pop-up that can populate a null field: "Please enter the client's first name."

NOTE: I cannot make these fields required in the database because we sometimes do not have all the infomration at the time the record is created.

THANKS
 
Can we assume the command button has some code that opens the report? If so, add some integrity checks like:
Code:
   Dim strRptName as String
   Dim strWhere as String
   strRptName = "rptYourReport"
   strWhere = "ClientID= " & Me.txtClientID
   If IsNull(DLookup("[Salutation]","tblClients", strWhere) Then
      If MsgBox("You must enter the salutation. Do you want to do this now?", _
         vbQuestion + vbYesNo, "Missing Info") = vbYes Then
         DoCmd.OpenForm "frmClients", , , strWhere, , acDialog
      End If
     Else
      DoCmd.OpenReport strRptName , acPreview, , strWhere
   End If

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top