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

Object required??

Status
Not open for further replies.

pbrown77

Technical User
Feb 21, 2005
55
US
There is a text box
CCS1
which allows the user to enter a 4 digit number to runt the report. However, I was thinking that if they were to delete the value and not replace it the report would go off.
Instead of running incorrectly it simply says invalid use of null.
Therefore I was thinking of a way to make a msgbox appear if they try to run the report with nothing in the text box.

I have tried...

Private Sub CCS1_AfterUpdate()
If Me.CCS1 < 1000 Or Me.CCS1 Is Null Then
MsgBox "No Summary Cost Center Selected"
Me.CCS1 = 0

End If

End Sub

but it says Object required. I have tested taking the "is null" part off and it work so my guess it is my wording.

Ideally I would like to put something on the report button instead basically reading... if the value in CCS1 is null or <1000 msgbox "need...." otherwise run the report

Any suggestions?
 
Hi!

Like this:

If Me.CCS1 < 1000 Or IsNull(Me.CCS1) Then

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
Another way:
If Nz(Me.CCS1, 0) < 1000 Then

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top