Form Focus - Acccess 2007

C

Chuck

I am opening a form by utilizing a macro initiated by the "Double Click"
property on a control of another form. For some reason the form opens but
does not get the focus. This has never happened to me before; however,
Access 2007 is new to me. I have tried to follow up the "OpenForm" Action of
the Macro with the "SelectObject" action (hoping to force the focus on to the
newly opened form) but this does not work. Why is this happening, and what
can I do about it?

Thanks Very Much,
Chuck
 
C

Chuck

Thank you Bob. I was afraid of that. The only solution that I can think of
is opening the form in the "Dialog" Window Mode.
 
C

Christopher Robin

Here's some code, I've been using for this very thing. I copied it from an
Access template some time ago, and it still works in newer versions of
access. I think it's basically the same work around that you found, so maybe
it's the way to do it.

Private Sub Store_DblClick(Cancel As Integer)
On Error GoTo Err_Store_DblClick
Dim lngStore As String

If IsNull(Me![Store]) Then
Me![Store].Text = ""
Else
lngStore = Me![Store]
Me![Store] = Null
End If
DoCmd.OpenForm "Stores", , , , , acDialog, "GotoNew"
Me![Store].Requery
If lngStore <> Null Then Me![Store] = lngStore

Exit_Store_DblClick:
Exit Sub

Err_Store_DblClick:
MsgBox Err.Description
Resume Exit_Store_DblClick
End Sub
 
C

Chuck

Thanks Christopher.

Christopher Robin said:
Here's some code, I've been using for this very thing. I copied it from an
Access template some time ago, and it still works in newer versions of
access. I think it's basically the same work around that you found, so maybe
it's the way to do it.

Private Sub Store_DblClick(Cancel As Integer)
On Error GoTo Err_Store_DblClick
Dim lngStore As String

If IsNull(Me![Store]) Then
Me![Store].Text = ""
Else
lngStore = Me![Store]
Me![Store] = Null
End If
DoCmd.OpenForm "Stores", , , , , acDialog, "GotoNew"
Me![Store].Requery
If lngStore <> Null Then Me![Store] = lngStore

Exit_Store_DblClick:
Exit Sub

Err_Store_DblClick:
MsgBox Err.Description
Resume Exit_Store_DblClick
End Sub

Chuck said:
Thank you Bob. I was afraid of that. The only solution that I can think of
is opening the form in the "Dialog" Window Mode.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top