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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check for empty fields on a form

Status
Not open for further replies.

MrsTFB

MIS
Oct 3, 2000
307
US
I have a form in Access2000. When a button is pushed for action, I want to check that all fields have been filled in. I'm trying within the event code of the button to write this code:

If RptDate.Value = Null Then
MsgBox "There must be an entry for Report Date."
Exit Sub
End If
If RecNum.IsEmpty Then
MsgBox "There must be an entry for Receiving Number."
Exit Sub
End If
If InspBy.Value = "" Then MsgBox "There must be an entry for Inspected By."

NONE of these solutions are working. How should I go about doing this?

I thought it would be a simple line of code, but it's not.

Thanks for any help!
MrsTFB in Tennessee
 
You must use either the IsNull function or the NZ function if you're sure the control either contains anything or are Null. If the control could contains zls (""), then the following test covers that:

[tt]if trim$(me!txtControl.value & "") = "" then
' Null or zls
end if[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top