Results 1 to 5 of 5
  1. #1
    rwahdan1978 is offline Advanced Beginner
    Windows 11 Access 2016
    Join Date
    Jun 2024
    Posts
    57

    saving records from 2 tables with one to many relationship

    Hi

    I have 2 tables (customers and invoices), one customer will have many invoices. In a form I have added the user and the invoice details and I have a button to save the data, how to do that with VBA sql?

    Username: ramiwahdan
    Invoice#:1234
    Date: 17-8-2024
    Payment Amount: 200

    where username is in one table and others in 2nd table.

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,932
    Which table are you storing username? In the customer table implies all invoices are to be credited to the customer ( but doesn’t look like you specify a customer). If in the invoice table, implies username is the person who entered the invoice

    so really not enough information to advise.

  3. #3
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,821
    Can you upload your database?

  4. #4
    rwahdan1978 is offline Advanced Beginner
    Windows 11 Access 2016
    Join Date
    Jun 2024
    Posts
    57
    Quote Originally Posted by mike60smart View Post
    Can you upload your database?
    Attached is my database
    Attached Files Attached Files

  5. #5
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,821
    Hi

    Your Form "Invoice" does not make much sense.

    Normal construction is that you would have a Main Form based on your table "Users"
    with a subform based on the table "Invoice"

    Your table "Invoice" has a PK set as Shorttext and it should be an Autonumber.

    You should not be setting a Format on the field "Payment1", this should just be a Currency DataType.

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

Similar Threads

  1. Replies: 2
    Last Post: 09-04-2018, 10:06 PM
  2. Replies: 5
    Last Post: 11-26-2013, 11:11 PM
  3. Replies: 1
    Last Post: 11-16-2013, 09:01 AM
  4. Saving Pivot Tables
    By djclntn in forum Forms
    Replies: 2
    Last Post: 01-04-2013, 09:00 PM
  5. Replies: 6
    Last Post: 06-09-2012, 08:17 AM

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