What I'm trying to do is this - I have a navigation form with multiple subforms. Each subform accesses different tables. I would like subform A if it is on record 10, say I switch to subform B, when I switch back to subform A I want it to automatically load record 10 (the last previous record).
The problem is all of the events in Access 2013 appear to fire BEFORE the form loads. So if I try to use browseto or searchforrecord it doesn't work. The current code in the subform that I want to load the previous record is:
where PubOperationOperation is a public variable that updates on oncurrent. PubOperationLoad just keeps track if oncurrent is firing because the form was loaded (in this case do not save the new record), or because the record was changed (in that case save the new record) Oncurrent reads:
The problem is all of the events in Access 2013 appear to fire BEFORE the form loads. So if I try to use browseto or searchforrecord it doesn't work. The current code in the subform that I want to load the previous record is:
Code:
Private Sub Form_Load()
PubOperationLoad = True
MsgBox "Load"
MsgBox PubCurrentOperation
If Not (IsEmpty(PubCurrentOperation) Or IsNull(PubCurrentOperation) Or PubCurrentOperation < 2) Then
DoCmd.SearchForRecord acForm, "Final UI Operation", , "ID=" & PubCurrentOperation
End If
End Sub
Code:
Private Sub Form_Current()
MsgBox "current"
If Not PubOperationLoad Then
PubCurrentOperation = Forms![Final UI Main Form]!NavigationSubform.Form.CurrentRecord
Else
PubOperationLoad = False
End If
End Sub