If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Using a datasheet subform as record selector
Dear all,
I have an unlinked datasheet subform which I'm using as a quick view list / record selector for the main (detail) form. Basically I'm trying to duplicate split form functionality, but I can't use a split form because it destorys my formatting. So far I have the following code: In the subform: With Me.Parent.RecordsetClone .FindFirst ("daID = " & Me.daID) If Not .NoMatch Then Me.Parent.Recordset.Bookmark = .Bookmark End If End With In the mainform: With Me.sfcAlertSplit.Form.RecordsetClone .FindFirst ("daID = " & Me.daID) If Not .NoMatch Then Me.sfcAlertSplit.Form.Recordset.Bookmark = .Bookmark End If End With This works well most of the time, but it sometimes (for no reason I can determine) gets into a fail state where it won't navigate properly. Here's what I've figured out so far: It won't enter the fail state if navigating in the main form. It won't enter the fail state if I click on the datasheet's record selector. It will enter the fail state unpredictably if I click a control in the subform. It will come out of the fail state if I click on the datasheet's record selector. It will occasionally come out of the fail state if I click a control in the subform. It will not come out of the fail state if I use the main form's navigation buttons, nor will it navigate to the next record. I put msgboxes into the procedures to test the firing order and which ID is passed; and these are the results: T is the target record ID and S is the source (i.e. current before navigation) ID. In normal state: Main form navigation: Main (T) - Sub (T) Subform navigation: Sub (T) - Main (T) In fail state: Mainform navigation: Main (T) - Sub (T) - Sub (S) - Main (S) Subform navigation: Sub (T) - Sub (S) - Main (T) - Sub (T) - Sub (S) - Main (S) What is causing the subform's Current event to fire twice? And with the old (no longer current) record ID the second time? Do you think that this is a timing issue? There's no other code in the subform; the main form has an unrelated command button with a short procedure. The main form does contain another, linked subform which does not have an On Current event. Any assistance, ideas, pointers or comments will be very much appreciated. Thank you, Alex. |
Thread Tools | |
Display Modes | |
|
|