View Single Post
  #6  
Old May 11th, 2010, 04:07 PM posted to microsoft.public.access
Jo
external usenet poster
 
Posts: 508
Default Stop incomplete details by the user?

hi i do not know code to well and when I put this piece in it is high lighted
in red so I am assuming there is an error with puchuation?
If Nz([Inspection By],"") "" And Nz([Channel],"") "" And
Nz([Station],"") "" Then


"RonaldoOneNil" wrote:

Create a function similar to below and then call it from the after update
event of each of your 3 fields and possibly the On Current event of the form.

Function CheckFields()
If Nz([Inspection By],"") "" And Nz([Channel],"") "" And
Nz([Station],"") "" Then
[PrintButtonName].Enabled = True
Else
[PrintButtonName].Enabled = False
End If
End Function

"jo" wrote:

What if there is more that one field they have missed?
these are the usual fields they miss: [Inspection By] [Channel] [Station]
thanks jo

"RonaldoOneNil" wrote:

Ideally the button should be disabled until all the relevant fields have data
in them but to answer your question
In the click event of your button put something like this

If Nz(Me.[Your Field Name],"") = "" Then
MsgBox "Please enter data into [Your Field Name]", vbInformation +
vbOKOnly, "Incomplete Data"
Me.[Your Field Name].SetFocus
Else
' continue with printing
End If

"jo" wrote:

Is it possible to add code to a form to inform the user that a field has not
been entered once they click the print button? And what would the code be?
please
Thanks Jo