Main form and subform to create additional records on two other tables

Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Main form and subform to create additional records on two other tables

  1. #1
    New Member
    Join Date
    Mar 2011
    Posts
    30
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Main form and subform to create additional records on two other tables

     
    I am sending this from my phone so I am unable to post any screenshots etc. sorry.

    I am trying to create an Inventory and sales database.
    I have loosly used the Microsoft Northwind template as a guide.
    I have a Sales form with a Sales Detail sub form.
    The sales form creates a new record on the sales table (Fields - Sale ID, Customer ID, Sales Date) and the sub form creates a new record on the Sales Detail table (Fields - Sales Detail ID, Sale ID, Product ID, Quantity, Unit Price). This works fine.

    I also need the Sales Date, Product ID and Quantity entered in the Inventory Transaction Table (Fields - Inventory Transaction ID, Transaction Date, Transaction Type ID, Product ID, Quantity).

    I can set the default value for the Transaction Type ID to that required for a sale in the Inventory Transaction Table but I don't know how to get the other data into the table.

  2. #2
    Board Regular
    Join Date
    Jun 2015
    Location
    Ontario, Canada
    Posts
    1,356
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Main form and subform to create additional records on two other tables

      
    Create an Append query that will write the values from the form when that form is open. Once you have it working, use an event to run that query. The event could be a button click that you're using to save the form. Not knowing the rest of the process and design means I can't say for sure which events you could use. Make sure you test append operations on copies of tables before implementing the process. Watch out for duplicate entries in case an event can fire more than once for the same record, such as a button click. Putting unique indexes on the table field can prevent it, but you might want to customize the error message that Access will otherwise present.
    Tips for posting problems:
    1) "doesn't work" doesn't help. Post error message text/numbers and/or state what's happening.
    2) if posting code or sql, use code tags; specify on which code line errors occur, if applicable
    3) try to be specific; assume we know nothing about your issue - because we don't!

    Make all suggested changes in copies of your database or to its objects.

    "1 out of 1010 people understand binary. The other 1001 don't."

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com