Question You are subscribed to this thread subforms GotFocus ev

C

Cyberwolf

I have a form that has a subform that contains a subform. On this 2nd subform
I have a control that has a GotFocus event. When I open the main form the
GotFocus event fires. Here is the code on the GotFocus event.


Private Sub ReasonID_GotFocus()
Dim intResp As Integer
On Error GoTo ReasonID_GotFocus_Error

stLinkCriteria = "[ReasonCodeID]=" & Me.ReasonCodeID
If Me.ReasonID = 1 Then
intResp = MsgBox("Would you like to view the RPP Cause records?",
vbYesNoCancel, "Releated RPP Cause Records available!")

If intResp = vbYes Then
DoCmd.OpenForm "frm_RPPCauseInfo", acNormal, , stLinkCriteria,
acFormReadOnly, acDialog
End If
End If

On Error GoTo 0
Exit Sub

ReasonID_GotFocus_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
ReasonID_GotFocus of VBA Document Form_frm_ReasonCodes_subform"
End Sub
 
J

John W. Vinson

I have a form that has a subform that contains a subform. On this 2nd subform
I have a control that has a GotFocus event. When I open the main form the
GotFocus event fires. Here is the code on the GotFocus event.

You've made a statement. As best as I can tell you have not asked a question.

Do you not want the event to fire? Do you want something else to happen when
it does?
 
C

Cyberwolf

Sorry,

Actually I figured this out. My questions was supposed to be, why is the
gotfocus event firing on the subform when the main form opens. I did some
more research and found that the gotfocus event fires when on a subform when
the form is opened because it loads all of the records for the main forms
record.
 

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