Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2003

    Angry Unanswered: detect and set current record on tab

    Hi all,

    I can't find a suitable solution for the following problem :
    I have a form (unbound) with a tab control with 3 tabs.
    Each tab contains a subform and all subforms are based on the same table.
    When a user selects a record in the first subform (let's call it SubA), a record becomes the current one.
    When the users switches to the second or third tab, I would like to have the same record being current so that he does not need to search for it again.
    All 3 subforms contain the ID of the record (primary key) so each record is uniquely identified when it is selected.

    If somebody has a solution for this, please let me know.

  2. #2
    Join Date
    Mar 2004

    Re: detect and set current record on tab

    I imagine you are using 3 seperate recordsets.

    If you are using ADO type in the following:

    rsData.Find "ID=" & rsData1.fields("ID")

    If you are using DAO type in the following:

    rsData2.FindFirst "ID=" & rsData1.fields("ID")

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

  3. #3
    Join Date
    Jun 2003
    Thanks for the reply but I'm afraid this is a little to simple :
    1. I work with bound subforms so I don't use a recordset as such
    2. It must work as well when the user changes the current record on the second or third tab.

    Let me tell what I have so far :

    In each form I use as subform, the event OnCurrent writes the current ID to an unbound textfield on the main form.
    In the event OnEnter for each of the subforms (but now considered as controls on the main form), i've put code that reads that unbound field (with the current ID) and then some routine to search for that particular ID in the subform.

    This works fine..... until you do this :
    On the main form, there is a button that sets a filter and requeries all the subforms. If you then use the scroll button on your mouse to scroll down in a subform, the event OnEnter (as explained above) is not triggered until you click in the subform. Result, the code OnCurrent is executed making the first record the current one (because we requeried, the first record already was current) and only then, the code OnEnter is executed but it directs the focus to the first record again and not to the one I clicked on.

    So what I need is a workaround for this bottleneck or a totally different way to set the current record.

    Anyone who still can follow this, send in your ideas!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts