(Access 2007)
I have a form with some controls in the header. By default the form detail is hidden. I have the following code on a button
The problem is that the focus isn't moving to the control surname.
If I remove the line Me.Detail.Visible = True and manually make the detail visible before clicking the button, then surname receives the focus.
I have noticed that if I click anywhere in the background of the detail section after clicking the button, then the cursor appears in the control.
It appears to be a similar problem to the one discussed here http://www.access-programmers.co.uk/forums/showthread.php?t=175507&highlight=setfocus but no one seems to have discovered the reason for the problem.
It's a very annoying little problem but I'm sure that must be a simple solution?
I have a form with some controls in the header. By default the form detail is hidden. I have the following code on a button
Code:
Private Sub newclient_Click()
Me.Detail.Visible = True
DoCmd.GoToRecord , , acNewRec
Me.surname.SetFocus
End Sub
If I remove the line Me.Detail.Visible = True and manually make the detail visible before clicking the button, then surname receives the focus.
I have noticed that if I click anywhere in the background of the detail section after clicking the button, then the cursor appears in the control.
It appears to be a similar problem to the one discussed here http://www.access-programmers.co.uk/forums/showthread.php?t=175507&highlight=setfocus but no one seems to have discovered the reason for the problem.
It's a very annoying little problem but I'm sure that must be a simple solution?