Results 1 to 7 of 7
  1. #1
    eldarbs is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    17

    Two different fields to one text box how?


    I want to create a text box on a form that will update two different fields from different tables simultaneously how ?
    Namely, How can I set the controlsource on the Properties of the textbox for two different fields ??

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    You can't. The ControlSource can be bound to only one field of the RecordSource. You can use VBA code to change the RecordSource property. Or use an unbound textbox and use VBA to save value to appropriate field.

    Why do you even need to do this?
    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
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    You can't! You'd have to use an Append or Update Query to assign it to the second Table...and this smacks of a non-normalized app...and you're talking about storing one bit of data in two different Tables! This is only considered acceptable if the Field is being used as a Primary Key/Foreign Key, to link two Tables together.

    Perhaps you'd better give us a more in-depth explanation of what you're doing, here.

    Linq ;0)>

  4. #4
    eldarbs is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    17
    tnx.
    I have one form that I linked to two tables by a query, one table for customers and another table for sales. the Form has one tab for filling customer data and another tab to fill sales data
    Both tables have a field called "Social Security Number" which I want to connect by it the relationship between the tables
    so when I fill the number in the form i want it to enter to both tables at the same time

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Then you need to scrap your Query and set up a Main Form/Subform scenario, with the SSN as the linking Field.

    For this kind of thing you'd typically have 2 Tables, as you already have, with Fields similar to this:

    CustomerTable
    SSN(Primary Key)
    Customer
    Address
    City
    State
    Zip

    SalesTable
    SalesID (Primary Key)
    SSN (as Foreign Key)
    ItemName
    UnitCost
    Purchase Date

    You'd have data from the CustomerTable as the RecordSet for a Main Form.

    Data from the SalesTable as the RecordSet for a SalesForm, which would be set as a Subform to Main Form. (Linked by the SSN Fields)

    There's no need for you to save the SSN to both Tables, as the Access Gnomes will place this in the SalesTable, automatically, since it is the Linking Field between Main Form/Subform.

    Linq ;0)>

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Here is reference on building form/subform http://office.microsoft.com/en-us/ac...010098674.aspx
    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.

  7. #7
    eldarbs is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    17
    hey, thanks for answers..
    i will try to build it in the form/subform...
    hope it would give me the right one..

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

Similar Threads

  1. Replies: 13
    Last Post: 06-21-2012, 09:03 AM
  2. Memo -- SQL text fields
    By jim56 in forum Access
    Replies: 0
    Last Post: 12-01-2011, 03:54 PM
  3. Conditional text box for two fields
    By hawkins in forum Access
    Replies: 9
    Last Post: 08-16-2011, 12:21 PM
  4. fields of type text
    By ashiers in forum Forms
    Replies: 0
    Last Post: 11-28-2008, 10:52 AM
  5. Split text field into two text fields
    By Grant in forum Access
    Replies: 6
    Last Post: 01-31-2008, 05:52 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