Results 1 to 5 of 5
  1. #1
    Opid is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    24

    Form with data from two tables


    Hello all, I am currently trying to create a form that allows the user to create a new record on a certain table named "transactions". Another table named "Tenant" holds information such as amount of rent due. I would like this form to display the amount of rent from the tenant table next to the pay rent text field of the transactions table. I have a combo box that allows the user to select a specific room number. This combo box should then populate the rent due field by getting the information from the Tenant table and the transaction table should be updated when the user clicks process. The room number should be then given to the transaction.unit field. Any help or suggestions would be appreciated. Let me know if this makes sense. Thanks in advance

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Room number is the pk/fk linking fields? If so, one way is to have the form RecordSource be a query that joins the two tables. The query jointype would be 'show all records from Transactions and only those from Tenant that are equal'. Bind textbox to the rent field from Tenant table and set properties: Locked to Yes and TabStop to No.

    Another method is multi-column combobox, one column has the rent field and can be hidden. A textbox has a ControlSource set to the rent column.
    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
    Opid is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    24
    Thanks for the help . Couple of questions though. How can you hide the columns easily and how do I access the rent column? When I select the controlSource for the textbox, the rent column does not appear. Is it some variation of combobox.rent?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Review this tutorial about multi-column combobox http://datapigtechnologies.com/flash...combobox3.html

    Textbox ControlSource refers to the rent column of combobox with: =comboboxname.Column(x)

    x is the index of the column. Column index starts with 0 so if rent is column 2 the index is 1.
    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
    Opid is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    24
    Thank you. Works perfectly.

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

Similar Threads

  1. Replies: 5
    Last Post: 08-12-2013, 12:53 AM
  2. Replies: 4
    Last Post: 02-27-2012, 10:29 AM
  3. Replies: 14
    Last Post: 01-10-2012, 03:12 PM
  4. Data from two tables on one form?
    By 10 Gauge in forum Forms
    Replies: 11
    Last Post: 02-15-2011, 04:09 PM
  5. Replies: 9
    Last Post: 03-24-2009, 09:19 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