Results 1 to 10 of 10
  1. #1
    jaymack70 is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2015
    Posts
    5

    Forms that create forms

    I am relatively new to Access, so my apologies for possibly asking dumb questions.



    I've created a form called "Initial Customer Contact Form." In that form, I have two buttons, both with the intended function of creating related forms. I want these new forms to bring over data, including the primary key, from the record on the main form. For example, I have a "Sales Form" button. When the button is used it would create a Sales record, which would share with the main form the customer's first and last names, a few other pieces of data, and the primary key.

    As it is, all the forms I've created are associated with their own tables.

    Not sure if the forms should share the same table and create a relationship between them using the primary key (Customer ID) or they should have separate tables with the same relationship.

    Again, my apologies if I have not communicated my situation very well. Thank you for the help.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    What is your data structure? Creating forms on the fly would be exceedingly rare. It sounds like you may have tables/forms for each customer, which would be a mistake.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    jaymack70 is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2015
    Posts
    5
    I guess my error was stating that my process was "creating related forms" when I should have stated "generating related forms," since all the forms have been created.

    What I am looking to do is have three of my forms share certain data from the active record and its database. For example, I open the main form and create a record of the inquiry. If the prospective customer returns to make a purchase, I reopen that record and use the Sales Form button to generate a Sales Record that brings over the primary key, First Name and Last Name, and a few other data points from the record in the main Contact Table.

    One question, as stated previously, is should they all have separate tables or share a single table?

    Structure

    Contact Table - Initial Customer Contact Form (these are my primaries)

    Sales Table - Sale Form

    Additional Contact Table - Additional Contact Form

    Occupant Table - Occupant Form

    Not sure if I've clarified anything or made it worse.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    You would be generating a new record on the sales form? You can use the new record argument of OpenForm and then populate fields with

    Forms!SalesFormName.ControlName = Me.ControlName

    replacing with the appropriate form and control names.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    jaymack70 is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2015
    Posts
    5
    Yes. By clicking the Sales Form button, the Sales Form would be activated so a new sales record could be created.

  6. #6
    jaymack70 is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2015
    Posts
    5
    Also, since I am very new to Access, where would I enter the information you provided above? Expression Builder? Thanks a million for your help.

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Okay; let me know if you have trouble implementing my suggestion.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    I personally only use VBA, not macros:

    http://www.baldyweb.com/FirstVBA.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    jaymack70 is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2015
    Posts
    5
    Thanks for the suggestion. What replaces the Me. portion of the code?

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    ControlName is replaced with the name on the first form that contains the data you want to copy to the second form.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 12
    Last Post: 06-03-2014, 08:04 AM
  2. Replies: 4
    Last Post: 05-28-2014, 06:43 PM
  3. need to create sub-forms with multiple entries
    By asinha9 in forum Database Design
    Replies: 2
    Last Post: 03-20-2013, 07:04 PM
  4. How to create a filter in forms?
    By williamc3502 in forum Forms
    Replies: 1
    Last Post: 06-25-2012, 12:29 AM
  5. Unable to create new record in Forms
    By escapades_access in forum Forms
    Replies: 5
    Last Post: 03-16-2011, 03:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums