Nov 3 2008, 09:43 AM
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?
Nov 3 2008, 09:55 AM
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.
Nov 3 2008, 10:04 AM
Thanks, I thought so.
Nov 3 2008, 11:23 AM
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?
Nov 3 2008, 02:55 PM
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.
In the Double-click event of one or more fields of the datasheet, you would need this:
Me.NameOfTextBox = Me.NameOfTextBox & Me.NameOfSubform!NameOfPrimaryKeyControl & ";"
Or 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.
Nov 18 2008, 02:46 PM
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 our main content. To view the full version with more information, formatting and images, please click here