473,378 Members | 1,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

option button required code needed

In my form I have an option group with 3 option buttons. My form is
tied to a table. the options are Temp, Permanent and Overtime.
I have these inside a frame. I have an AddRecord button to enter the
data into the table. After the record is Added the option buttons are
emptied.

I want to require the person to click one of the option buttons, which
enters the type of employee it is.

In the click event of the AddRecord button I have the following code.

If Me.Frame60.Value = Me.Frame60.DefaultValue Then
MsgBox ("You must pick one of the options")
GoTo Err_cmdUpdate_Click
End If

The Err_cmdUpdate_Click should exit the AddRecord without updating the
table.

The problem is the first time this works, but if they correct the
first one, and they don't enter the type of worker the second time,
the messagebox appears, but the data is entered into the table anyway.

I need a way to make sure the data is only entered if one of the
option buttons is clicked.

When they first open the form, the option buttons are grey, after the
first entry of data, the option boxes are white. I get the feeling
that the option buttons are in a different state at that point, which
is probably causing the frame value to have changed.

Mar 17 '06 #1
1 4487
As I always announce, I'm not an expert but this is what I would do.

As you want to store the results of the option button in your table, I would
add a field, named to your choice of number type and set the 'Required'
property to True. This will make sure that a record created has to have a
value entered for this field.

Make sure the wizard is switched on
From the 'Toolbox' toolbar, drag an option group to your form
Enter your 3 label names (Temp, Perm & Overtime) and hit next
Select "No - I don't want a default" and hit next
The values should be displayed which will be 1, 2 & 3. Hit next
Select "Store the value in this field" and select the new field you've
created
Choose the formatting of your choice and hit next
Give the option group a meaningful name and hit finish

Regards,

Mark
"Stephen D Cook" <st******@comcast.net> wrote in message
news:60********************************@4ax.com...
In my form I have an option group with 3 option buttons. My form is
tied to a table. the options are Temp, Permanent and Overtime.
I have these inside a frame. I have an AddRecord button to enter the
data into the table. After the record is Added the option buttons are
emptied.

I want to require the person to click one of the option buttons, which
enters the type of employee it is.

In the click event of the AddRecord button I have the following code.

If Me.Frame60.Value = Me.Frame60.DefaultValue Then
MsgBox ("You must pick one of the options")
GoTo Err_cmdUpdate_Click
End If

The Err_cmdUpdate_Click should exit the AddRecord without updating the
table.

The problem is the first time this works, but if they correct the
first one, and they don't enter the type of worker the second time,
the messagebox appears, but the data is entered into the table anyway.

I need a way to make sure the data is only entered if one of the
option buttons is clicked.

When they first open the form, the option buttons are grey, after the
first entry of data, the option boxes are white. I get the feeling
that the option buttons are in a different state at that point, which
is probably causing the frame value to have changed.

Mar 17 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Rithish Saralaya | last post by:
Is there a way to scroll a selected OPTION into view? I have a combination of text box and SELECT list. A user can key in text in the text box, and depending on the entry made, the respective...
3
by: ewitkop90 | last post by:
Here is my code: <SCRIPT> function transportchange(transport) { if (framenewinstall.Helpdesk.checked) framenewinstall.Helpdesk.checked=false; if (framenewinstall.CircuitNumber.checked)...
2
by: NishSF | last post by:
Would anyone have any suggestions/javascript code so that if one clicks the Radio Button "Yes" below he has the option of selecting any of the six CheckBox below. If the user clicks on Radio Button...
9
by: Ritesh Raj Sarraf | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I'm using optparse module to parse all options and arguments. My program uses mostly "option arguments" hence my len(args) value is always...
1
by: Stephen D Cook | last post by:
What I am trying to do is have a set of option buttons which are required to click one. If the person doesn't click any before insert, they get an error. If they do click one, it inserts into the...
0
by: solar | last post by:
Can somebody help me build an option button in a toolbar ? I mean a button with dropped down 2 possibilities needed to build a code.I can build a single button with the code shown below.i will be...
2
by: Thelma Lubkin | last post by:
I've been unable to find code for adding an option to an option group. I did find this instruction on a site called softlookup.com: "If you want to add another option button to an option group,...
2
beacon
by: beacon | last post by:
Hi everybody, I have a form that has a combo box that asks the user to select the program they work on. Once the user selects the program, a SQL statement populates the row source for 4 staff...
3
by: Venturini | last post by:
I am trying to put together a web page where the customer makes choices of products and is then given a total. I am extremely new to Javascript and have managed to get as far as I have from web...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.