Checkboxes & Tab Control

SueAccess

Registered User.
Local time
Today, 04:28
Joined
Jan 22, 2005
Messages
26
I am new to Access coding. I'm trying to do the following in Access 2000.

I have a form which includes some tabs. On one tab I would like to display a list of items from an Access lookup table with a checkbox next to each item. The list needs to be drawn dynamically from the table since the table contents can change. I tried using the subform/subreport control with a querry as the source object but the display is not very nice. Basicly I want the tab to look like the picture enclosed but dynamically drawn from the values in the lookup table.

Any help would be greatly appreciated.

Thanks

Sue
 

Attachments

Welcome to Access coding, SueAccess!

I will describe the simple, quick and dirty method of creating the form that you want. Keep in mind you may have done a few of these steps, but it's best for me to start from beginning to end.

What you want to display is quite easy. On the page of the tab control you want to display the information, place a subform control. On the properties list, change the Border Property to Transparent, and the Special Effect Property to Flat. Note the Width size of the subform control; you will use it to help create the subform. Save all changes and close the form.

Next, open a new form in design view. Immediately go to the properties list and change the following items (follow carefully):

Format Tab
Default View: Continuous Form
Scroll Bars: Vertical Only*
Record Selectors: No
Navigation Buttons: No
Dividing Lines: No

*This has to do with the amount of records you will have to display. More on this after the rest of the explanation.

Data Tab
Record Source: tblName (This is the table with the fields you want)

Now, create two controls on the subform. First, create a checkbox control. Click the label that was attached to the checkbox and delete it, leaving just the checkbox. Move it to the upper left corner, as far as you can. Name it something appropriate, like "chkRecord". Next, create a textbox control. Delete the attached label, leaving just the textbox. Move it to the right of the checkbox. Name the textbox control "txtRecord".

Re-click the checkbox control. On the Property box for chkRecord, go to the Data Page. Under Control Source, click the dropdown arrow on the right side of the control. Find the boolean field you want to bind the control to and select it.

Next, click the textbox control. On the property window, change the following properties:

Format Tab
Back Style: Transparent
Special Effect: Flat
Border Style: Transparent

For Width, do the following. First, take the width of the subform control that you noted earlier. Now, subtract the value from the Left property of the textbox. Finally, subtract about .2 inch from THAT calculation, and place that number in the Width column. This actually can be adjusted anytime, but this calculation usually doesn't have to be adjusted.
Once this is done, click the Data Tab,

On Control Source, select the field of the table you wish to display.
Since you won't be changing the field name, change Enabled to No, and Locked to Yes. This will prevent the focus from entering those fields.

Once you have finished this task, resize the form so it

On the form, resize the bottom border by making it flush with the bottom of the textbox, and the right border flush with the right side of the text box.

Click the save icon, and save the form as "sbfRecords" (or any other name you choose). Close the form.

Re-open the main form. Click the subform control. On Properties, click Data. On the dropdown arrow in Source Object, bind the control to sbfRecords.

Now open the main form. You should be able to see something very similar to your screenshot. You can edit the checkbox field of the recordset directly in this manner.

Earlier, I had cited the Scroll Bars as Vertical Only. You will see a scroll bar, even if there are fewer records than the height of the subform control can display. If you KNOW FOR A FACT that you won't have more records than the height of the subform control, you can change the Scroll Bars option from Vertical to None, but keep in mind if at any time you return more records than can be seen, you won't be able to navigate to those records except through the keyboard.

Hope this helps you get a good start. Frankly, there is a lot I've left out as far as checking table normalization, etc, and I'm not a thrill of binding at design time or directly to tables, but for beginning this should work fine.
 
That's pretty clever mresann. I never would have thought of that. Thank you very much for taking the time to help me. Your instructions were excellent!

Sue
 

Users who are viewing this thread

Back
Top Bottom