checkbox to select records in datasheet.

travisdh

Registered User.
Local time
Today, 01:51
Joined
Jul 5, 2010
Messages
64
Hello.

I feel like i am not getting very far with what I am trying to now achieve, i want to be able to have a checkbox (preferabally not in the table since this would be a multi-user database) that is displayed in the form which is a datasheet. Basically the form has an autoID element which is SampleID, it has a projectID field (lookup), ParentSample (text) and Description (text).

How do i go about creating a checkbox on the form that is bound to the sampleID, so that when the checkbox is checked, i can run through all the records to get all of the SampleID's that apply to the checked records and then apply a task based on that, from delete, to duplicate, to more importantly add samples based on that. So for example i check boxes beside samples 1,3,6 and 9 and then click the button, and it inserts new samples into the same table, but one sample has 1 in the parentsample, another has 3 and so on.

I want to avoid using this in the table if i can, as i am worried if another user comes along and checks one of their samples, it will get confused.

i had tried a checkbox, and set the controlstate to =IsChecked([SampleID]) but it shows up blue, and when i go to click on it, it says "control can't be edited, it is bound to the expression isChecked([SampleID])
 
I'm having a hard time following all of your scenario, especially the =IsChecked([SampleID]) part. I assume that IsChecked() is a custom function, since it is not an Access native function.

But the gist of your question appears to be that you want an Unbound checkbox, i.e. one not tied to a field in the underlying table, on each record to us to mark the record for some action, and this cannot be done!

When you see an Unbound control on multiple records, you are actually seeing multiple instances of the same control. If you tick the control on one record, the control will be ticked on all records. If you then untick the control, on any record, they will all be unticked.

The usual method of doing what you speak of is to have a Bound checkbox, perform whatever, based on the checkbox being ticked or not, then programmatically unticking all of the checkboxes.

BTW, any control that has anything in its Control Source except the name of a field from the form's underlying table or query cannot, as you've discovered, be edited.

Linq ;0)>
 
when i set the controlsource of that checkbox to that of the SampleID, i still get the same error, that it is bound to autoID field name SampleID and can't be edited. why would this be the case?

RuralGuy: thanks for the information about the lookup fields, i guess i could remove the lookup field of the projectID and just have it automatially entered, however how do people get around needing to have lookup fields in some cases eg selecting a client for a report or invoice etc?

Thanks
 
RuralGuy: thanks for the information about the lookup fields, i guess i could remove the lookup field of the projectID and just have it automatially entered, however how do people get around needing to have lookup fields in some cases eg selecting a client for a report or invoice etc?

Thanks
It is fine to have a ComboBox on a form that works the same way (preferable actually) just not at the table level.
 
You need to add a new field to your table, defined as a Yes/No Datatype, and assign it as the Control Source for your checkbox. You can't set the checkbox Control Source to an already existing ID field, especially one that, going by your original post, is an AutoNumber field.
 
Thanks for that, it seems like a somewhat redundant requirement to make a field in a table that is yes/no to simply select a record. The issue that i had was that if there are a lot of concurrent users on the database, then multiple people might select different records and then the query is run on all selected records instead of just the ones it should really be run on.

My way around it is to have a selectedby field as well, which when the box is checked, it will put the person's username in there, so the query will run on the username of that person, and when the box is unchecked it will remove that name from that field.
 
If this form is only going to be used for selecting certain records then I would suggest you use a multiselect listbox.
 

Users who are viewing this thread

Back
Top Bottom