Results 1 to 6 of 6
  1. #1
    rdscott is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    9

    Help with SQL code

    All fields not mentioned for simplicity.

    Table Invoices – fields: invoiceno (autonumber), college
    Table Members – fields: member, college, new-member-flag
    Table InvoiceMembers – fields: invoiceno, member

    Form creates records for the table invoices after selecting college. Would like to use command button to create records in table InvoiceMembers. Fields to populate:
    InvoiceMembers.invoiceno from form.invoiceno
    InvoiceMembers.member from members.member


    for members.college equal to form.college and member.new-member-flag is true

    How can this be done?

    Thanks

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,603
    Don't need college in Invoices table.

    Create a form/subform arrangement http://office.microsoft.com/en-us/ac...010098674.aspx

    Main form bound to Invoices, subform bound to InvoiceMembers with a combobox to select members. If member not in combobox list, use NotInList event http://www.blueclaw-db.com/access_no...ed_example.htm
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    rdscott is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    9
    college is who the invoice is billed to so college needs to be there. that is collegeid (college for short, to simplified things) that links to a college (customer) file. The reason for the invoicemembers table is show what members were billed on an invoice. The members will stay with that invoice. The invoice table and invoicemembers table will be linked together by invoiceno. i need invoicemembers to be created from members table for new members. i hope this explains a little better. Thanks

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,603
    Okay, only thing I will add is that you probably want to make the combobox to select members dependent on the college selected in college combobox. Review: http://datapigtechnologies.com/flash...combobox2.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    What's the purpose of the new_member_flag? How does it get reset? (Access does not like the "-")
    Have you considered a BecameMemberDate and do some calculations based on that Date?

  6. #6
    rdscott is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    9
    I appreciate all the comments. To clarify: I have two tables. College and CollegeMembers (one to many). College Members are added frequently. When creating an invoice for a college for general inventory, i need to also pull into the invoice the new members that were added since last invoice was created. That is the reason for InvoiceMembers table and NewMemberFlag. Flag set to false when new members are inserted into InvoiceMembers. End result is having an invoice table and invoicemembers (one to many relationship). I need the code that would be in the form to insert the invoice number (from the form) and the new members (from the collegemembers) into invoicemembers table. Thanks again for your input.

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

Similar Threads

  1. Report Code is not allowing return to main code
    By rcwiley in forum Programming
    Replies: 2
    Last Post: 06-16-2013, 10:31 AM
  2. Replies: 7
    Last Post: 05-28-2013, 09:11 AM
  3. Replies: 1
    Last Post: 05-04-2013, 12:19 PM
  4. Word code in Access - How to modify my current code
    By Alexandre Cote in forum Programming
    Replies: 0
    Last Post: 11-15-2010, 08:26 AM
  5. Code in combobox, code in text box
    By float in forum Forms
    Replies: 3
    Last Post: 09-29-2010, 07:12 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