473,839 Members | 1,400 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.c om
http://www.accessmonster.com/Uwe/For...ccess/200801/1

Jan 11 '08 #1
7 6522
On Jan 11, 2:59 pm, "pushrodeng ine via AccessMonster.c om" <u36225@uwe>
wrote:
I have a command button "AddInciden t". 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 "AddInciden t"
button is pressed.

Thank You

--
Message posted via AccessMonster.c omhttp://www.accessmonst er.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
On Fri, 11 Jan 2008 19:59:41 GMT, pushrodengine via AccessMonster.c om
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
>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
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
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
On 12 Jan 2008 17:05:46 GMT, Susan Bricker <sl*****@verizo n.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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
4760
by: Samantha Smit | last post by:
Hi, I am trying to create a simple asp page that has one command button that updates a database. The URL of the page is like this: http://MyServer.com/Update.asp?UserName=Tom My asp code is like this: %@ Language=VBScript %> <!--#include file="includes/openconnection.asp"-->
8
11842
by: dakman | last post by:
Recently, I have been needing to do this alot and I can never find a way around it, the main reason I want to do this is because for example in the application I am making right now, it creates a grid of buttons in a loop and they all have the same purpose so they need to call the same method, within this method they need to change the background color of the button clicked, I've tried stuff like... button = lambda: self.fill(button) ...
9
5928
by: Toralf Kirsten | last post by:
Hi, we installed db2 v8.1 on red hat linux 9. Unfortunately, the backspace and the delete button doesn't work in the right way. Instead of deleting chars, control characters are inputed. That makes it very hard to input sql commands at the db2 command line prompt. For example: DB2> connect to aDatabase^?^?^?^?^[[3~^[[3~^[[3~ Is there the possibility to set an option / parameter anywhere? Thanks, Toralf
4
8956
by: MJW | last post by:
Is there a way for me to know if or which command button was just clicked that triggers the LostFocus event for the current control on a Form? I have a form that has many types of users who each have their own set of fields they can change. Therefore I use setfocus property in the lostfocus event for some of the users to get from one control to another. Since I am "directing traffic" with setfocus, the users are unable to use the...
2
9294
by: Chris Bolus | last post by:
I'm a teacher using MS Access on an RMConnect 2.4 network. On some workstations both I and my students sometimes get an error message when attempting to insert a command button on a form which reads "Invalid use of null". The remainder of the options in the Command Button Wizard are then unavailable and the button wil not work. The only solution is to log on to a different workstation. Any ideas?
9
5730
by: Melissa | last post by:
What is the code to delete a command button from a form? Can the code be run from the click event of the button to be deleted? Thanks! Melissa
3
3027
by: Susan Bricker | last post by:
Is it possible to make command buttons (in forms) have a background color? Or is there a means to simulate a command button and make it have a background color and able to kickoff a 'click' event? Thanks. Sue *** Sent via Devdex http://www.devdex.com *** Don't just participate in USENET...get rewarded for it!
14
4981
by: Kevin | last post by:
A couple of easy questions here hopefully. I've been working on two different database projects which make use of multiple forms. 1. Where's the best/recommended placement for command buttons for things like delete, save, edit, cancel buttons - in the footer, or on the form detail section? 2. If in the footer, how do you add them to the tab order?
4
17379
by: Alex Chun | last post by:
How can I program a command button on a form to bring up the standard "Find and Replace" dialog on click? Separate but related: how do you run menu commands (e.g. "Edit" "Find") from VB? Thanks in advance! Alex
4
4808
by: John Smith | last post by:
I have a continuous form. there is a command button with the following code for the OnClick event: DoCmd.OpenForm "frmPlants", , , "PlantsID =" & Me!PlantsID I click the button and frmPlants opens up with the record that corresponds to the one on the cont. form. I put that same code for the OnClick of an image control (i.e. the user clicks a little icon to open the form instead of a button) and frmPlants
0
9697
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10908
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10586
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10648
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10293
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7828
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7017
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4484
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3134
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.