Results 1 to 4 of 4
  1. #1
    Allison56 is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2016
    Posts
    2

    tranferring data from one form to populate another using a command button

    Hi,
    I have basic skills in access and have encountered a problem.
    I have two forms one is a basic customer details another is a quote form with calculations. I would like a button once I have entered a new customers details on my customers form that will transfer them directly to the same fields on my quotes form.


    any ideas?

    Allison

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    to the forum......


    It depends on your table structure/relationships.

    First, some terminology.

    Tables have fields. Tables store data, not forms.
    Forms have controls, not fields. A bound form has a record source that is a table or query. Controls on a form can be bound or unbound. If a form is unbound, all controls on that form are unbound. If a control is bound, the control's "Control Source" property is bound to a field from the form's record source.



    OK.....back to the question.
    If the two forms have two different record sources (ie two different tables) AND the same customer fields are in both tables, you can have code that will copy (transfer) the data from one table to a different table.

    In a relational database, this is considered a poor design.

    I would have a table for Customer info and a table for quotes.
    The relationship would be 1 to many. (1 customer can have many quotes and 1 quote will have only 1 customer.)
    I would use a form with a sub form. The main form would be the customer(s) and the sub form would be the quotes.

  3. #3
    Allison56 is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2016
    Posts
    2

    Smile

    Quote Originally Posted by ssanfu View Post
    to the forum......


    It depends on your table structure/relationships.

    First, some terminology.

    Tables have fields. Tables store data, not forms.
    Forms have controls, not fields. A bound form has a record source that is a table or query. Controls on a form can be bound or unbound. If a form is unbound, all controls on that form are unbound. If a control is bound, the control's "Control Source" property is bound to a field from the form's record source.



    OK.....back to the question.
    If the two forms have two different record sources (ie two different tables) AND the same customer fields are in both tables, you can have code that will copy (transfer) the data from one table to a different table.

    In a relational database, this is considered a poor design.

    I would have a table for Customer info and a table for quotes.
    The relationship would be 1 to many. (1 customer can have many quotes and 1 quote will have only 1 customer.)
    I would use a form with a sub form. The main form would be the customer(s) and the sub form would be the quotes.

    ........... Thanks for the advice, my first design was exactly as you have explained with a subform. It worked fine in most instances but the trouble was if you started doing calculations on the quote (subform) before you entered the customer details you would then lose all the information as the calculations would zero. Since the form records were ordered by customerID and not QuoteID you couldn't just go back to the last record to find them. Any suggestions would be appreciated.

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Sounds like it might be a design issue. Would have to see your dB.

    If the quotes table had a "Customer_FK" field, you wouldn't be able to save a new record in the quotes table because the "Customer_FK" would be required. This forces you to select a customer (the one table) before creating records in the quotes table (the many).

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

Similar Threads

  1. Command button to populate subform
    By akhlaq768 in forum Forms
    Replies: 2
    Last Post: 02-07-2012, 04:57 AM
  2. Replies: 3
    Last Post: 10-17-2011, 01:13 PM
  3. Populate text boxes with a command button
    By Brian62 in forum Forms
    Replies: 3
    Last Post: 09-30-2011, 12:52 PM
  4. Replies: 0
    Last Post: 03-24-2011, 09:59 AM
  5. Replies: 26
    Last Post: 01-09-2011, 05:30 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