Form/Subform help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hawg1
    New Member
    • Sep 2006
    • 7

    Form/Subform help

    I'm fairly new to Access and need help with form/subform. I've seen another access database in which a main form allowed the user to enter school class specific information shuch as start date, title and class size. Once they tabbed out of the class size box, a subform appeared to allow input of student data. For example, if class size of 4 was entered, subform would appear with four data input lines, one for each student.
    I can generate the main form and a subform but do not know how to code the subform so that the number of input lines match the class size value (1 -10). Any suggestions/ideas?

    thanks

    hawg1
    ksskr@earthlink .net
  • PEB
    Recognized Expert Top Contributor
    • Aug 2006
    • 1418

    #2
    Hi,

    If you know how to create the main and the sub form the rest is easy...

    You need an After Update event which is stored to the filed where you indicate the size of the class

    and an Append query that adds records to the table used by your subform...

    The after Update event should have a structure like this:

    Code:
    Dim i
    For i = 1 to Me![Class_size]
      DOCMD RunSQL "YOUR append query"
    next i

    :)
    Originally posted by hawg1
    I'm fairly new to Access and need help with form/subform. I've seen another access database in which a main form allowed the user to enter school class specific information shuch as start date, title and class size. Once they tabbed out of the class size box, a subform appeared to allow input of student data. For example, if class size of 4 was entered, subform would appear with four data input lines, one for each student.
    I can generate the main form and a subform but do not know how to code the subform so that the number of input lines match the class size value (1 -10). Any suggestions/ideas?

    thanks

    hawg1
    ksskr@earthlink .net

    Comment

    • hawg1
      New Member
      • Sep 2006
      • 7

      #3
      PEB,

      Thanks for the info on the coding. Will give it a try!

      Comment

      Working...