new form based on selection

pirsein

New member
Local time
Today, 14:34
Joined
Feb 3, 2006
Messages
5
Is there a way to take a form, select the fields that you want to display on a template(I created the template)? Then the fields that aren't selected grey/disable them? In other words. We perform several tests, ie. test 2006.01 and 2006.02 etc. Each test is based on 1 table. So instead of having to go in each time a new test is needed, can I create a form that has selectable fields(checkboxes), and once I say ok it opens the "new" template it will have the fields that need to be on that test then grey out the ones that aren't going to be used this time around? Sort of new to this....
 
If I understand you correctly, you need to do some VBA juju. What you can do is add a checkbox or whatever next to each field on the form and then add a button on the form. Use the wizard to make the button open your second form. Now, go into the properties of the second form, go to Events and click in OnOpen. You should see a grey "..."; click on that.

This opens up the code editor. I'm not much of a whiz when it comes to code so this probably won't be perfect, but you'll need to do something along the lines of:

If
Form1.Checkbox1 = False

Then
Me.Field1.Enabled = False

Where Form1 is the form with the checkboxes, Checkbox one is the checkbox next to the first field, and Field1 is the first field on the new form. 'Me' is code for "whatever form I'm in right now". This code looks at the checkbox on the first form and if it is not checked, it greys out the corresponding field. Repeat for each field.
 
Great thanks! With a few mods it worked perfectly!
 

Users who are viewing this thread

Back
Top Bottom