By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,165 Members | 853 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,165 IT Pros & Developers. It's quick & easy.

Error Trap Zero or Null Values

P: n/a
Hi, I'm trying to write code that will not allow users to continue
unless a Product Sale is entered. This is what I have so far:

Private Sub ForecastProductSale_BeforeUpdate(Cancel As Integer)
If Nz(JobEstimatedProductSale, "") = "" Then
MsgBox "Warning: A Product Sale must be entered.", vbOKOnly,
"Warning"
Exit Sub
End If

End Sub

Can someone please tell me what I'm doing wrong?

Thanks.

Jan 11 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
I did answer the 'almost' same question yesterday ...
But you had code like If IsNull(Me.ForecastProductSale) Then

You need "Cancel=True' instead of "Exit sub"

Arno
<er************@gmail.comschreef in bericht news:11**********************@i39g2000hsf.googlegr oups.com...
Hi, I'm trying to write code that will not allow users to continue
unless a Product Sale is entered. This is what I have so far:

Private Sub ForecastProductSale_BeforeUpdate(Cancel As Integer)
If Nz(JobEstimatedProductSale, "") = "" Then
MsgBox "Warning: A Product Sale must be entered.", vbOKOnly,
"Warning"
Exit Sub
End If

End Sub

Can someone please tell me what I'm doing wrong?

Thanks.
Jan 11 '07 #2

P: n/a
Your code does not trap zero. Try the following, assuming
JobEstimatedProductSale is numeric.

If Nz(JobEstimatedProductSale, 0) = 0 Then

"Arno R" <ar***********@tiscali.nlwrote in message
news:45**********************@text.nova.planet.nl. ..
I did answer the 'almost' same question yesterday ...
But you had code like If IsNull(Me.ForecastProductSale) Then

You need "Cancel=True' instead of "Exit sub"

Arno
<er************@gmail.comschreef in bericht
news:11**********************@i39g2000hsf.googlegr oups.com...
Hi, I'm trying to write code that will not allow users to continue
unless a Product Sale is entered. This is what I have so far:

Private Sub ForecastProductSale_BeforeUpdate(Cancel As Integer)
If Nz(JobEstimatedProductSale, "") = "" Then
MsgBox "Warning: A Product Sale must be entered.", vbOKOnly,
"Warning"
Exit Sub
End If

End Sub

Can someone please tell me what I'm doing wrong?

Thanks.

Jan 11 '07 #3

P: n/a
"paii, Ron" <pa**@packairinc.comschreef in bericht news:gZ******************************@athenet.net. ..
Your code does not trap zero. Try the following, assuming
JobEstimatedProductSale is numeric.

If Nz(JobEstimatedProductSale, 0) = 0 Then

Then what??
The OP was asking for code that will not allow users to continue...

Arno R
Jan 11 '07 #4

P: n/a

"Arno R" <ar***********@tiscali.nlwrote in message
news:45***********************@text.nova.planet.nl ...
"paii, Ron" <pa**@packairinc.comschreef in bericht
news:gZ******************************@athenet.net. ..
Your code does not trap zero. Try the following, assuming
JobEstimatedProductSale is numeric.

If Nz(JobEstimatedProductSale, 0) = 0 Then

Then what??
The OP was asking for code that will not allow users to continue...

Arno R

You already gave him that.
Jan 11 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.