Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2014
    Posts
    20

    Capture event: highlighting record row within query or subform


    Good Morning,

    Thanks for everyone's help. I'm currently working through an issue and was wondering if someone can help me out.

    Data Environment: Two tables with a one to many relationship
    Form: Two subforms. Subform 1 = Table A, Subform 2 = Table B
    Goal: highlight a record located in table A and have the many records appear in table B
    Basic Mechanics: When a record row is highlighted in Table A, a textbox updates with the primary key of that record. The textbox's record source is a query. And then table B is suppose to update based upon the primary key in the textbox with the primary key. I am not using the record selector within the table; I turned that off.
    Issue: Can't capture the event when a different record in table A is selected, after the initial record is selected.
    What is Working: The initial record selection choice (Enter, Event)

    Event's that I've tried:
    1. Subform_Enter
    2. Textbox_AfterUpdate
    3. Textbox_BeforeUpdate
    4. Textbox_Change
    5. Textbox_Dirty
    6. Textbox_Current
    7. Form_Current

    What confuses me: the subform only has 2 events; 1) Enter 2)Exit

    Can someone point me in the right direction?

    Thanks,
    BrainExplodingFromCoffee

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    you cant have a main form with a list
    and a sub form.

    you can either:
    have a LIST form that shows all records in a list. A Detail button in the header to jump to a new form with 1 single master record, and subform below
    or
    have the single record form with subform, and a combo box to 'filter' whatever is chosen to 'jump' to that record.
    Code:
    sub cboBox_afterupdate()
      if isnull(cboBox) then
         me.filterOn = false
     else
        me.filter = "[clientID]=" & cboBox
         me.filterOn = true
    endif
    end sub

  3. #3
    Join Date
    Apr 2014
    Posts
    20
    I'm not quite sure that I get what your saying.

    I have filters to update table A, and those work. I was thinking about using the value of the text box with the primary key to update table B. But, I just can't capture the event for when a record row is highlighted or that textbox's queried value changes.

    Am I going about this the wrong way? I feel like this is something that Microsoft should have implemented.

    Thanks!

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    you don't have to high lite a row,
    if the cursor is on any field, every field value is available on that row. so you can get any field needed.
    The event when you change records is, ON CURRENT.

  5. #5
    Join Date
    Apr 2014
    Posts
    20
    Hi Ranman,

    Thanks for your help. We found a workaround to make this a possibility. I'm not sure if it's as elegant as your solution but here it goes.

    Since we have the text box updating with the primary key of the highlighted record, Table B will have to be linked to that textbox. So, set "Link Master Field" to the textbox control and the "Link Child Field" as the primary key. I had this before, but the event handlers were blocking the update or doing some other funky stuff.

    In any event, thanks for the time you put into this thread. I'm going to mark it as "Solved". Rep++

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

Similar Threads

  1. Capture an “Enable Macros” warning event
    By LindaRuble in forum Programming
    Replies: 1
    Last Post: 03-19-2013, 10:22 AM
  2. Replies: 2
    Last Post: 02-28-2013, 07:29 AM
  3. Replies: 3
    Last Post: 03-11-2012, 08:24 PM
  4. How do I capture Access DB exit event
    By jscriptor09 in forum Access
    Replies: 3
    Last Post: 09-21-2011, 09:45 AM
  5. Replies: 2
    Last Post: 07-24-2011, 08:50 PM

Tags for this Thread

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