Please could you help me with a tabular form?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Lionheart
    New Member
    • May 2012
    • 2

    Please could you help me with a tabular form?

    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:
    Code:
    If Forms!Staff!August!Function = 8 Then
    Forms!Staff!August!Learner.Enabled = True
    Else
    Forms!Staff!August!Learner.Enabled = False
    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!!
    Last edited by NeoPa; May 10 '12, 10:37 PM. Reason: Added mandatory [CODE] tags for you.
  • mshmyob
    Recognized Expert Contributor
    • Jan 2008
    • 903

    #2
    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,

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32661

      #3
      Why Values in Unbound Form Controls do not Persist may help.

      Comment

      • Lionheart
        New Member
        • May 2012
        • 2

        #4
        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
        Last edited by Lionheart; May 11 '12, 09:19 AM. Reason: Typo!

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32661

          #5
          Apologies Lionheart. I did, indeed, miss the point there. Lucky Rob had you covered anyway :-)

          Comment

          • mshmyob
            Recognized Expert Contributor
            • Jan 2008
            • 903

            #6
            Good luck with the rest of your project.

            cheers,

            Comment

            Working...