Results 1 to 2 of 2
  1. #1
    Grahamiwa is offline Novice
    Windows 98/ME Access 97
    Join Date
    May 2011
    Posts
    6

    Main form and Sub form to create records on two tables

    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).

    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
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    Once you enter data into the tables, you need a 'save' button that would acually write the transaction.
    Prevent the user from leaving the screen until this button is clicked and runs the append query to the tTransaction table , and close the form.
    Maybe an invisible checkbox that indicates if the query was run.

    user clicks SAVE
    runs the transaction query
    marks the chkSaved = true
    then close the form.

    If user tries to close form with chkSaved = false, it stays open
    Code:
    Private Sub Form_Unload(Cancel As Integer)
      if  chkSaved.value = false then msgbox "You must SAVE the data"
       cancel = chkSaved.value = false
    End Sub

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

Similar Threads

  1. Replies: 1
    Last Post: 11-05-2015, 04:16 AM
  2. Replies: 5
    Last Post: 05-28-2015, 03:27 PM
  3. Replies: 11
    Last Post: 05-13-2015, 11:10 PM
  4. Replies: 2
    Last Post: 10-22-2014, 11:39 AM
  5. Replies: 2
    Last Post: 11-13-2012, 02:11 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