Results 1 to 5 of 5
  1. #1
    keiath is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    162

    Sub Form auto populate

    I have 2 tables One is Called 'Lead Accountants' and contains the following fields
    'ID'
    'Accountant'
    'Rate'



    in the other table (subform) called Billing Hours i have the following fields

    'ID'
    'Site Number' (which links the records to the table)
    'Date Worked'
    'Accountant'
    'Hours'
    'Rate'
    'Comments'

    After creating the subform i change the 'Accountant' to a combo field (so i can select the accountant) I now want this to populate the 'Rate' field automatically from the first table.

    I tried this:-

    Private Sub CboAccID_Change()
    Me.Rate.Value = Me.CboAccID.Column(1)
    End Sub

    with no results, but I dont think this is pointing to the right table, Any ideas?

    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
    52,816
    Use the combobox AfterUpdate event.

    Code does not point to the table directly, it addresses the Rate field/textbox of the form. Are you sure the code is addressing the correct column of the combobox? Column index begins with 0.
    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
    keiath is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    162
    ok I was using on change, switch to afterupdate when I use (0) it displays the ID Number, when I use (1) it displays the Accountants Name, but when I try to use the (4) nothing displays?

    I even changed the table so that the rate is the second coloum still not showing rate????

  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
    52,816
    Show combobox properties:

    RowSource
    ControlSource
    BoundColumn
    ColumnCount
    ColumnWidths

    If you want to provide db, follow instructions at bottom of my post. Identify objects involved.
    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
    keiath is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    162
    Hi Thank You so Much as soon as i saw the RowSource I realized I didn't add into the query the Rate! Duh!

    Problem Sovled

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

Similar Threads

  1. How to auto populate a form
    By e51lrrp in forum Forms
    Replies: 42
    Last Post: 03-20-2014, 11:40 PM
  2. How to auto populate in tex box form
    By kft10 in forum Forms
    Replies: 3
    Last Post: 06-12-2013, 11:47 PM
  3. Auto Populate form
    By fpsmi in forum Access
    Replies: 1
    Last Post: 09-16-2011, 09:24 AM
  4. Auto-populate form question: again!
    By revnice in forum Access
    Replies: 5
    Last Post: 08-06-2010, 04:02 PM
  5. Auto-populate form question
    By revnice in forum Access
    Replies: 19
    Last Post: 08-06-2010, 01:01 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