Full Version: Subform checkbox on datasheet format needs to be independent
UtterAccess Forums > Microsoft® Access > Access Forms
I have a subform that is in a datasheet format. I put an unbound checkbox on the subform and it looks great but I can't seem to check the box for an individual record....it checks them all. How do I get it to be independent?
This cannot be done. Appearances notwithstanding, the unbound controls on a datasheet share the same property settings. Therefore, checking one checks them all. If you open the form in design view, you will see that there is only one checkbox control on the form. That is repeated as many times as necessary to display the records contained in the subform.
You're going to have to come up with another way to do this.
Thanks, I thought so.
Ok, scrap the checkbox idea.
Can I highlight the record(s) in the datasheet on the subform and then click a button on the main form to only select the ones highlighted?
It is not that simple. My suggestion would be to switch to continuous forms view of the subform. Then alter the record source so that the primary key of each record is part of each row. I would hide it. Then, the user can just double-click the desirable rows. At each double-click you can put the Primary Key into a text box, joining it to the previous values with a suitable separator, say a ; (anything will do, as long as it cannot be mistaken for part of a data value). So for instance, if your PK is type AutoNumber, then the ; will do nicely. The user would then click a "go" button on the form.
On the Double-click event of one or more fields of the datasheet, you would need this:
Me.NameOfTextBox = Me.NameOfTextBox & Me.NameOfSubform!NameOfPrimaryKeyControl & ";"
FOr you could put a list box on the main form. In the double-click event of one or more fields in the subform, add whatever fields you want to the row source of the list box. Its RowSourceType would need to be Value List for this to work.
Then whatever you want to do can be done using the contents of the list box or the text box.
I am in a similar situation. I have a subform which I can double click the records and add the records to the textBoxes in my main form. My question is: can I highlight those records which has been clicked in the subform?
Thanks for the help!
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.