|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I currently have a table with 50-60 fields that are all checkboxes. I want to print only the field names that have been checked on a form. So if there are fields A, B, C, D, E, etc and only fields B, G and L are checked, I only want those field names printed on a form. How can I accomplish this?
|
|
#2
|
|||
|
|||
|
Hi mboster,
Your question is simple in nature, but the answer is going to be fairly complex I am afraid. There are two ways to go about this: 1) Add all the controls (one for each checkbox) onto your report or form. Then either make the control visible or not visible depending on the value of the checkbox. The problem with this method is leaving a lot of blank or open spaces on your form or report where those controls that are invisible will be. The work around would be to use vba code to move the controls that are visible to where you want them on your form/report. But that can be a little tricky. 2) Create a recordset with only the controls that have been checked. Then you can use the CreateControls vba function to add only the controls for each of the fields from your sql. This would require a little bit of vba coding and you would have to delete all the prior controls from your form or report, if you are reusing the same form/report each time. Or you can use the create form/report function then delete the form/report after it has been printed. This might be an easier method given the number of fields from your table and with the number of possible combinations you might have. A sample code can be found in the access help files for creating a form and controls in design view using vba, and can be easily adapted to using the sql. If you need help in building the sql, creating the recordset from the sql or implementing the code, post back. lwells |
|
#3
|
|||
|
|||
|
lwells,
I have tried option 1, and the blank spots in the form (Report actually) are distracting to the users when printed. When all fields are visible, the printout is two pages, double columns for each record. All I really want is the information printed. It doesn't have to be displayed on the screen in a form, I just thought a form (Report) might be easier. Either way, I _will_ need assistance with the coding. If you want, I can send you the db for reference. Compacted and empty it's ~450kb. mboster |
|
#4
|
|||
|
|||
|
Hi mboster,
Figured that you were talking about a report and yes the blank spaces would be annoying to the user. Go ahead and send your db to my email lwells1433@aol.com and I will be happy to get you started with the coding. lwells |
|
#5
|
|||
|
|||
|
Hi, I'm having the same issue as mboster. I was wondering if you could help me please.
|
|
#6
|
|||
|
|||
|
To get rid of the blank spaces, make sure "Can Shrink" is Yes.
|
|
#7
|
|||
|
|||
|
What how do I add "all the controls" to each checkbox...I have to many....
![]() |
|
#8
|
|||
|
|||
|
same problem
Quote:
Hello Mboster, I am having the same problem you had. I was wondering if you could help me please. Thanks. |
|
#9
|
|||
|
|||
|
To put several controls on a form or report at one time, select them all from the field list and drag them in. To change the properties for all of them, select only the control part of each.
|
|
#10
|
|||
|
|||
|
Thanks Clarafication
|
|
#11
|
|||
|
|||
|
Hello all
look at this example and tell if its good for u |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > Print only checked fields on form |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|