Need a msgbox when text box is empty

G

Guest

For some reason, this simple thing is getting me. I have a form that a user
will type an account # in a text box in then click a button to open a new
form. It is an unbound text box with no calculations on it or anything. If
it is empty/blank/null, then I want a message box to pop up telling them they
need to type something in that text box before proceeding.

I have tried is Null: only to get Access Error "Object Required."
Private Sub cmdAddMissingCPrequest_Click()
If Forms![frmBiller-MissingChargesinCP]!txtAccount Is Null Then
MsgBox "Please enter an account # to proceed."
Else
DoCmd.OpenForm "frmBiller-ROEsAndOracle#sList"
DoCmd.Maximize
End If
End Sub

Also, tried ="" : and it goes on to the form when I want it to pop up a
message!
Private Sub cmdAddMissingCPrequest_Click()
If Forms![frmBiller-MissingChargesinCP]!txtAccount = "" Then
MsgBox "Please enter an account # to proceed."
Else
DoCmd.OpenForm "frmBiller-ROEsAndOracle#sList"
DoCmd.Maximize
End If
End Sub
 
S

Steve

Try IsNull(Forms![frmBiller-MissingChargesinCP]!txtAccount)

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)
 
G

Guest

Hi worksfire,

If isnull(Forms![frmBiller-MissingChargesinCP]!txtAccount) or
Forms![frmBiller-MissingChargesinCP]!txtAccount = "" Then
msgbox "blah blah blah" etc. etc

in this way you check both cases (null or blank) with just an if

HTH Paolo
 
G

Guest

Thank you!!!!

Just curious, why did it not work the way I had written the IF .... is null
statement?

Steve said:
Try IsNull(Forms![frmBiller-MissingChargesinCP]!txtAccount)

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)




worksfire1 said:
For some reason, this simple thing is getting me. I have a form that a
user
will type an account # in a text box in then click a button to open a new
form. It is an unbound text box with no calculations on it or anything.
If
it is empty/blank/null, then I want a message box to pop up telling them
they
need to type something in that text box before proceeding.

I have tried is Null: only to get Access Error "Object Required."
Private Sub cmdAddMissingCPrequest_Click()
If Forms![frmBiller-MissingChargesinCP]!txtAccount Is Null Then
MsgBox "Please enter an account # to proceed."
Else
DoCmd.OpenForm "frmBiller-ROEsAndOracle#sList"
DoCmd.Maximize
End If
End Sub

Also, tried ="" : and it goes on to the form when I want it to pop up a
message!
Private Sub cmdAddMissingCPrequest_Click()
If Forms![frmBiller-MissingChargesinCP]!txtAccount = "" Then
MsgBox "Please enter an account # to proceed."
Else
DoCmd.OpenForm "frmBiller-ROEsAndOracle#sList"
DoCmd.Maximize
End If
End Sub
 
G

Guest

Thank you!!! That works.

Paolo said:
Hi worksfire,

If isnull(Forms![frmBiller-MissingChargesinCP]!txtAccount) or
Forms![frmBiller-MissingChargesinCP]!txtAccount = "" Then
msgbox "blah blah blah" etc. etc

in this way you check both cases (null or blank) with just an if

HTH Paolo

worksfire1 said:
For some reason, this simple thing is getting me. I have a form that a user
will type an account # in a text box in then click a button to open a new
form. It is an unbound text box with no calculations on it or anything. If
it is empty/blank/null, then I want a message box to pop up telling them they
need to type something in that text box before proceeding.

I have tried is Null: only to get Access Error "Object Required."
Private Sub cmdAddMissingCPrequest_Click()
If Forms![frmBiller-MissingChargesinCP]!txtAccount Is Null Then
MsgBox "Please enter an account # to proceed."
Else
DoCmd.OpenForm "frmBiller-ROEsAndOracle#sList"
DoCmd.Maximize
End If
End Sub

Also, tried ="" : and it goes on to the form when I want it to pop up a
message!
Private Sub cmdAddMissingCPrequest_Click()
If Forms![frmBiller-MissingChargesinCP]!txtAccount = "" Then
MsgBox "Please enter an account # to proceed."
Else
DoCmd.OpenForm "frmBiller-ROEsAndOracle#sList"
DoCmd.Maximize
End If
End Sub
 
S

StopThisAdvertising

Steve said:
Try IsNull(Forms![frmBiller-MissingChargesinCP]!txtAccount)

PC Datasheet

--
Get lost Steve!! We don't need you here !!, but....
==>Let's ask it the 'nice' way...
Would you please, please go away Steve ??

This is to inform 'newbees' here about PCD' Steve:
http://home.tiscali.nl/arracom/whoissteve.html (updated, mainly the 'abuse-reporting' page...)
Until now 3800+ pageloads, 2400+ first-time visitors
(these figures are real and rapidly increasing)

Why is this ???
Because Steve is the ONLY person here who continues to advertise in the groups.

It is not relevant whether he advertised in *this* particular post or not...
==> We want him to know that these groups are *not* his private hunting grounds!

For those who don't like too see all these messages:
==> Simply killfile 'StopThisAdvertising'.
Newbees will still see this warning-message.

ArnoR
 
S

Steve

Is Null amd Is Not null are expressions that can only be used in the
criteria of fields in a query.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)




worksfire1 said:
Thank you!!!!

Just curious, why did it not work the way I had written the IF .... is
null
statement?

Steve said:
Try IsNull(Forms![frmBiller-MissingChargesinCP]!txtAccount)

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)




worksfire1 said:
For some reason, this simple thing is getting me. I have a form that a
user
will type an account # in a text box in then click a button to open a
new
form. It is an unbound text box with no calculations on it or
anything.
If
it is empty/blank/null, then I want a message box to pop up telling
them
they
need to type something in that text box before proceeding.

I have tried is Null: only to get Access Error "Object Required."
Private Sub cmdAddMissingCPrequest_Click()
If Forms![frmBiller-MissingChargesinCP]!txtAccount Is Null Then
MsgBox "Please enter an account # to proceed."
Else
DoCmd.OpenForm "frmBiller-ROEsAndOracle#sList"
DoCmd.Maximize
End If
End Sub

Also, tried ="" : and it goes on to the form when I want it to pop up a
message!
Private Sub cmdAddMissingCPrequest_Click()
If Forms![frmBiller-MissingChargesinCP]!txtAccount = "" Then
MsgBox "Please enter an account # to proceed."
Else
DoCmd.OpenForm "frmBiller-ROEsAndOracle#sList"
DoCmd.Maximize
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top