Kevin D. said:
I want to move to the last control to have the focus if the last control was
ItemNum, otherwise to the default control.
Kevin D
"Storrboy" wrote:
I think I'm half asleep today. I've missed or misread a great many things
today.
Before you do your navigation code, store the name of the last control to
have the focus by setting a form public variable to
Screen.PreviousControl.Name. If no other controls have had focus, then an
error will occur, so be sure to allow the code to continue if one occurs.
Example
'In the declaration section of form module
'-------------------------------------------
Dim strContrlName As String
'Before navigation code in button
'-------------------------------------------
On Error Resume Next
strControlName = Screen.PreviousControl.Name
If Err <> 0 Then strControlName = ""
In the OnCurrent event of the form (so that for each change in record
position this will fire) check the variable and move to the desired control.
I don't know what you mean by the "default control" as when using the
built-in nav buttons, the focus stays with the one that had it last - so you
may need to specify which is the "default"
If strControlName <> "ItemNum" Then strControlName = "[DefaultControlName]"
Me.Controls(strControlName).SetFocus
Did I get it this time?