Command Button Message Box

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/Forums.aspx/databases-ms-ac cess/200801/1
u36225 [ Fr, 11 Januar 2008 20:59 ] [ ID #1905420 ]

Re: Command Button Message Box

On Jan 11, 2:59 pm, "pushrodengine via AccessMonster.com" <u36225 [at] 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.asp x/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.
manningfan [ Fr, 11 Januar 2008 21:28 ] [ ID #1905422 ]

Re: Command Button Message Box

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
fredg [ Fr, 11 Januar 2008 21:49 ] [ ID #1905424 ]

Re: Command Button Message Box

>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
u36225 [ Fr, 11 Januar 2008 22:04 ] [ ID #1905426 ]

Re: Command Button Message Box

I got it using a combination of both codes.

Thank you ManningFan and fredg.

--
Message posted via http://www.accessmonster.com
u36225 [ Fr, 11 Januar 2008 22:21 ] [ ID #1905428 ]

Re: Command Button Message Box

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 ***
Susan Bricker [ Sa, 12 Januar 2008 18:05 ] [ ID #1906152 ]

Re: Command Button Message Box

On 12 Jan 2008 17:05:46 GMT, Susan Bricker <slbrick [at] 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.
arch [ Sa, 12 Januar 2008 19:12 ] [ ID #1906159 ]

Re: Command Button Message Box

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
'--------------------------
John Mishefske [ Di, 15 Januar 2008 04:14 ] [ ID #1908256 ]
Datenbanken » comp.databases.ms-access » Command Button Message Box

Vorheriges Thema: Hotkeys (Keyboard Shortcuts)
Nächstes Thema: Training Record DB