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

Command Button Message Box

P: n/a
I have a command button “AddIncident”. I would like to make it so that it
will not add the record to the database if textbox “Type” is empty. I also
would like to add a message that will prompt the user with the message “You
must enter incident Type” when textbox “Type” is empty and the “AddIncident”
button is pressed.

Thank You

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200801/1

Jan 11 '08 #1
Share this Question
Share on Google+
7 Replies


P: n/a
On Jan 11, 2:59 pm, "pushrodengine via AccessMonster.com" <u36225@uwe>
wrote:
I have a command button "AddIncident". I would like to make it so that it
will not add the record to the database if textbox "Type" is empty. I also
would like to add a message that will prompt the user with the message "You
must enter incident Type" when textbox "Type" is empty and the "AddIncident"
button is pressed.

Thank You

--
Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/2008...
In the OnClick event of the button, do something like:

if me.checkbox = -1 then
msgbox "Check the box, dummy!"
exit sub
else
'Do whatever you want the button to do
end if

NOTE: The above will need some tweaking, I'm, just going off the top
of my head. But it should be about 90% useable as written.
Jan 11 '08 #2

P: n/a
On Fri, 11 Jan 2008 19:59:41 GMT, pushrodengine via AccessMonster.com
wrote:
I have a command button AddIncident. I would like to make it so that it
will not add the record to the database if textbox Type is empty. I also
would like to add a message that will prompt the user with the message You
must enter incident Type when textbox Type is empty and the AddIncident
button is pressed.

Thank You
What does the command button actually do?
any way....
Code the Form's BeforeUpdate event:

If IsNull([Type]) Then
MsgBox You must enter incident Type when textbox 'Type' is empty and
the 'AddIncident' button is pressed."
Cancel = true
End If


The
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Jan 11 '08 #3

P: n/a
>What does the command button actually do?

This button is the Add New Record command button.

The problem I'm having is that blank records can be add to the database. The
way to prevent this careless pressing of the AddIncident button is to require
the user to enter a type into the "Type" textbox.

No Type = No Add New Record = Message Box.

Thanks

--
Message posted via http://www.accessmonster.com

Jan 11 '08 #4

P: n/a
I got it using a combination of both codes.

Thank you ManningFan and fredg.

--
Message posted via http://www.accessmonster.com

Jan 11 '08 #5

P: n/a
Another method would be to not enable the user to click on the command
button (enable=false) until the requisite fields are populated. You
could change the command button's attribute in the AfterUpdate routine
of the input fields you are concerned about. Then the command button
would only be accessible AFTER the data had been entered on the screen.

I like to do it this way to prevent the user from doing anything I don't
want them to do before I am ready for them to do it.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Jan 12 '08 #6

P: n/a
On 12 Jan 2008 17:05:46 GMT, Susan Bricker <sl*****@verizon.net>
wrote:
>Another method would be to not enable the user to click on the command
button (enable=false) until the requisite fields are populated. You
could change the command button's attribute in the AfterUpdate routine
of the input fields you are concerned about. Then the command button
would only be accessible AFTER the data had been entered on the screen.

I like to do it this way to prevent the user from doing anything I don't
want them to do before I am ready for them to do it.

Regards,
SueB
That's my preference as well. I think it makes for a more "polished"
application.
Jan 12 '08 #7

P: n/a
Susan Bricker wrote:
Another method would be to not enable the user to click on the command
button (enable=false) until the requisite fields are populated. You
could change the command button's attribute in the AfterUpdate routine
of the input fields you are concerned about. Then the command button
would only be accessible AFTER the data had been entered on the screen.

I like to do it this way to prevent the user from doing anything I don't
want them to do before I am ready for them to do it.
I'm interested in this technique too but how do you provide feedback to
the user who can't determine why the button isn't enabled?

I suppose you can indicate required data entry with a special backcolor
or (like a web form) a special character next to the field (yecchh).

Or a label with explicit instructions.

--
'--------------------------
' John Mishefske
' UtterAccess Editor
' Microsoft MVP 2007, 2008
'--------------------------
Jan 15 '08 #8

This discussion thread is closed

Replies have been disabled for this discussion.