How to create new fields in a form on the fly

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cmbirk
    New Member
    • May 2010
    • 18

    #1

    How to create new fields in a form on the fly

    Hi everyone,
    I am trying to create an access database for reporting in my division, and I need to be able to create new fields in a form as they get used. For example, if someone fills in a particular date field, I need to keep that date field, but add a new date field right below it in the form. This is because the commitment dates for certain projects can be changed, but the old dates need to be kept. I am pretty new to access and VB, but I am very good at Java and C. Any help would be appreciated.

    Thanks
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    You really can't do this! Stop and think about it. You're not talking adding a field to the form, you're talking about adding a field to the record, which means to every record in the underlying table! If one project had, say 12 dates, every record would have 12 date fields!

    You have two choices here. If you have a finite number of revision dates, say four or five, you can simply add these fields to the underlying table and only use them if needed. If you cannot guess at a maximum number or the number can be extremely large, you need to create a separate table for holding the commitment dates, with a data field and a project ID field. You'd then have to use this table as the basis for a subform on your main projects form.

    Welcome to Bytes!

    Linq ;0)>

    Comment

    • cmbirk
      New Member
      • May 2010
      • 18

      #3
      Thanks a bunch... I used a subform for multiple items and it works great... easy fix

      Comment

      • missinglinq
        Recognized Expert Specialist
        • Nov 2006
        • 3533

        #4
        That's the way to go when you need an undefined number of fields holding essentially the same type of data, as was the case here. the Glad we could help!

        Linq ;0)>

        Comment

        • cmbirk
          New Member
          • May 2010
          • 18

          #5
          Now I have a main form with a project ID, and a multi-input form for each date change. I need to report on these IDs. Is there a way to group on the ID in the main form, and include the subform reports under each main ID?... That is, If I have ids 23, 43, and 54... can I group the main report on these IDs, and only include their corresponding subform reports in the grouping?

          Thanks

          Comment

          Working...