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

Gererating an error message when field not entered on form

P: n/a
This one should be easy, I think. I have an unbound form with 2 controls: a
textbox and a command button. The textbox should contain a value when the
command button is clicked. If it doesn't, the user should received a
"Nothing in this field" message of some sort. Currently, I'm getting a
"syntax error" message. I have tried using the afterupdate event of the
textbox but this system-generated message comes up before that gets hit
apparently. The field is for a date. I want it to say "date not entered"
not "syntax error". It is not a table field. The form is unbound. How can
I do this?

Robert
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Mon, 19 Apr 2004 13:46:17 -0400, "Robert" <pr**********@yahoo.com>
wrote:
This one should be easy, I think. I have an unbound form with 2 controls: a
textbox and a command button. The textbox should contain a value when the
command button is clicked. If it doesn't, the user should received a
"Nothing in this field" message of some sort. Currently, I'm getting a
"syntax error" message. I have tried using the afterupdate event of the
textbox but this system-generated message comes up before that gets hit
apparently. The field is for a date. I want it to say "date not entered"
not "syntax error". It is not a table field. The form is unbound. How can
I do this?


Assume that your unbound text box is named txtUnboundText and that
your command button is named cmdDoSomething.

In the OnClick event of the cmdDoSomething command button put the
following code:

if len(Nz(me.txtUnboundText,""))<1 then
MsgBox "Uh, you need to put something into the text field if you
expect me to do something!"
else
....... put your commands that you want to execute here
endif

mike

Nov 12 '05 #2

P: n/a
Thanks. It's working now.
Robert
"Mike Preston" <mb**************@pacbell.net> wrote in message
news:40****************@news.INDIVIDUAL.NET...
On Mon, 19 Apr 2004 13:46:17 -0400, "Robert" <pr**********@yahoo.com>
wrote:
This one should be easy, I think. I have an unbound form with 2 controls: atextbox and a command button. The textbox should contain a value when thecommand button is clicked. If it doesn't, the user should received a
"Nothing in this field" message of some sort. Currently, I'm getting a
"syntax error" message. I have tried using the afterupdate event of the
textbox but this system-generated message comes up before that gets hit
apparently. The field is for a date. I want it to say "date not entered"not "syntax error". It is not a table field. The form is unbound. How canI do this?


Assume that your unbound text box is named txtUnboundText and that
your command button is named cmdDoSomething.

In the OnClick event of the cmdDoSomething command button put the
following code:

if len(Nz(me.txtUnboundText,""))<1 then
MsgBox "Uh, you need to put something into the text field if you
expect me to do something!"
else
...... put your commands that you want to execute here
endif

mike

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.