By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,221 Members | 1,121 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,221 IT Pros & Developers. It's quick & easy.

Please could you help me with a tabular form?

P: 2
I have set up a timesheet for an educational establishment, which has a subform by month where teachers enter times, incorporated into a main form which has their details. The subform is set up as a tabular form, so the teacher can pick date, start time, end time etc. I want to add a learner field which only becomes enabled once the teacher picks a certain value in the function field. I have used the following code:
Expand|Select|Wrap|Line Numbers
  1. If Forms!Staff!August!Function = 8 Then
  2. Forms!Staff!August!Learner.Enabled = True
  3. Else
  4. Forms!Staff!August!Learner.Enabled = False
  5. End If
The problem is: this is enabling or disabling ALL Learner fields in the subform. How do I make it specific to the record being entered?

Thanks.

PS - I am very new to VBA so I am transfering ZXSpectrum BASIC skills. Please be patient with me!!
May 10 '12 #1

✓ answered by mshmyob

If I am understanding you correctly you have a subform and when you change the visibility on the control they all turn off.

If that is the case the subform is working like it should. What you can do is as follows:

1) Ensure the form is set for 'Continuous forms view' not datasheet view
2) Select the control in the subform you want to hide (in this case only disable not hide). I think you have called it Learner.
3) Click on the Design tab at the top of the screen
4) Click on 'Conditional'
5) In the Default formating ensure the enabled state is active.
6) In the conditional section select 'Expression is'
7) Your expression should be something like 'Function = 8' (without the quotes)
8) Click on the enabled button to turn off the enabled state in this section.


What should happen is if the Function control has a value of 8 then the Learner control will become disabled. You may reverse this to have all of the Learner controls disabled by default until a value is entered in the Function control. If it is not an 8 then the Learner control becomes enabled.

cheers,

Share this Question
Share on Google+
5 Replies


mshmyob
Expert 100+
P: 903
If I am understanding you correctly you have a subform and when you change the visibility on the control they all turn off.

If that is the case the subform is working like it should. What you can do is as follows:

1) Ensure the form is set for 'Continuous forms view' not datasheet view
2) Select the control in the subform you want to hide (in this case only disable not hide). I think you have called it Learner.
3) Click on the Design tab at the top of the screen
4) Click on 'Conditional'
5) In the Default formating ensure the enabled state is active.
6) In the conditional section select 'Expression is'
7) Your expression should be something like 'Function = 8' (without the quotes)
8) Click on the enabled button to turn off the enabled state in this section.


What should happen is if the Function control has a value of 8 then the Learner control will become disabled. You may reverse this to have all of the Learner controls disabled by default until a value is entered in the Function control. If it is not an 8 then the Learner control becomes enabled.

cheers,
May 10 '12 #2

NeoPa
Expert Mod 15k+
P: 31,419

P: 2
Hi Mshmyob.

That sorted it and it was so easy!!

Thank you!

NeoPa - Thanks for the advice. This wasn't an unbound field, it was a combo where if the teacher picked one-one teaching (value 8) then they would have to enter the learners name, but I only wanted it if they specifically picked Value 8 because you know how people like to be insane with this sort of thing. If it was always enabled, they would try to put the full class list in!! :-D
May 11 '12 #4

NeoPa
Expert Mod 15k+
P: 31,419
Apologies Lionheart. I did, indeed, miss the point there. Lucky Rob had you covered anyway :-)
May 11 '12 #5

mshmyob
Expert 100+
P: 903
Good luck with the rest of your project.

cheers,
May 11 '12 #6

Post your reply

Sign in to post your reply or Sign up for a free account.