473,387 Members | 1,760 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,387 software developers and data experts.

Reflect Value of CheckBox in Field

Hullo,

I'm only contracted in where I'm working and I'm trying to strip a lot of the VBA out so the in-house development can make changes easier.

I was wondering if I could set a control source on a checkbox and make the checkbox fill the control source depending on whether it is ticked or unticked?

For example if there was a field "WantSandwich" and a checkbox next to a label saying "Do you want a sandwich?" connected to it then ideally when the user clicked the checkbox it would set the "WantSandwich" field to "Yes" and if it were unticked it would set it to "No"

Regards,
Harry

P.S. I know this is a horrible way to do it and it should really be better laid out as a database, but this is all I have to work with
Dec 15 '11 #1
4 2860
TheSmileyCoder
2,322 Expert Mod 2GB
I don't get what your trying to say.
For example if there was a checkbox for the field "WantSandwich" and a checkbox next to a label saying "Do you want a sandwich?" connected to it then ideally when the user clicked the tickbox it would set the "WantSandwich" field to "Yes" and if it were unticked it would set it to "No"
Are you using 2 checkboxes to track the same thing here?
Dec 15 '11 #2
Ah, sorry. Explained it badly.

I meant to say:

"For example if there was a field "WantSandwich" and a checkbox next to a label saying "Do you want a sandwich?" connected to it then ideally when the user clicked the checkbox it would set the "WantSandwich" field to "Yes" and if it were unticked it would set it to "No""
Dec 15 '11 #3
TheSmileyCoder
2,322 Expert Mod 2GB
First off, lets try to get the definitions right, as it makes communication easier.

A field is what you find in your table, your query or your recordset. It is also sometimes referred to as columns, but the most correct term is field. Examples could be ID_Person, tx_FirstName, tx_SurName, tx_PhoneNumber.

A field cannot be next to a label. A control such as a textbox, a combobox, or a checkbox can be next to a label. A control can be unbound (Controlsource is empty) or bound (Controlsource lists the field to which it is bound) or calculated (The controlsource lists a calculation, such as "=[Price]*[Amount]")



The following is all about bound forms (Form has a recordsource) and bound controls (see above)
Now if you have a field WantSandwich, and the type of field is set to be a YES/NO field, with a default value of No (almost always remember default values in Yes/No fields), in your table, and you have pulled that field or the entire table into your form, and bound it to a checkbox by setting the checkboxes CONTROLSOURCE to be WantSandwich, then any click on that checkbox will change the value of the field WantSandwich in your table, for the currently selected record.

I hope that makes sense.
Dec 15 '11 #4
NeoPa
32,556 Expert Mod 16PB
It certainly makes sense to me, and includes a lot of helpful explanations which are well worth taking note of.

In case it's not as easy for the OP (Harry) to understand I'll just add that all you need to do in your situation is to include the name of the field from your table ([WantSandwich]) in the ControlSource property of your CheckBox. This will ensure all changes to the CheckBox are reflected in the related field.

This is no different from what Smiley was saying. It simply expresses the same idea slightly differently.
Dec 15 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: TekWiz | last post by:
I've got a system that automatically generates a form. I have it set up so that the backend will return to the inital form page with an error object in sessions data (assuming the backend detected...
3
by: William Wisnieski | last post by:
Hello Again, I'm really stuck on this one.....so I'm going to try a different approach to this problem. I have a query by form that returns a record set in a datasheet. The user double...
2
by: MLH | last post by:
Fields in MyTable: PostID PostDate RollQtyXfer RollDenomination RollCount37 RollCount23
7
by: turtle | last post by:
I want to find out the max value of a field on a report if the field is not hidden. I have formatting on the report and if the field doesn't meet a certain criteria then it is hidden. I want to...
5
by: vandanavai | last post by:
Hello, I have problem in setting default value of field. What I want to do is as follows. I have 'Table' with fields 'PurchaseDate' and 'CapitalisationDate'. I want to set dafault value of field...
0
by: Shankari | last post by:
<script type="text/javascript" language="javascript"> function test(active) { if (active == 1) return true; else return false; } </script>
5
by: antony123 | last post by:
Hai All hard coders , Tell me how to get the value of field in a record in a recordset onject in visual basic using is index rather than the field name.Please help me .
2
by: anvidc | last post by:
Hi All, how to write a script for a button to select all my checkbox fields http://aycu04.webshots.com/image/27763/2000406210499185174_rs.jpg I'm Using MS Access 2000 thank you
2
by: Mikhail Teterin | last post by:
Hello! I'm going through the fields of a class one at a time and need to handle differently depending on whether they are arrays or scalars. What's the right way to make the distinction? The...
3
by: Daniel Baumann | last post by:
Hello! I am working on an Access 2007 database which contains a combo box with checkboxes for a multi value data field (I dont like this of course but I cannot change now). I want to read out the...
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$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...

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.