tab control question

  • Thread starter Thread starter JohnE
  • Start date Start date
J

JohnE

I have a mainform (usrfrmPricing) and on it there is a tab
control (TabCtl4) with 3 tabs (one is
usrfrmTakeoverClaims). Each of the tabs has a subform
located on it. On each subform there is a button that
brings up another form that has the states listed. The
list box of states is multiselect. Once the states are
selected, there is a transfer button on the popup states
form to transfer the names over to a States field on the
subform. The code behind the transfer button is listed
below.

Private Sub cmdfrmTakeoverClaimsSelectStatesTransfer_Click
()
Forms![usrfrmPricing]![usrfrmTakeoverClaims].Form!
[States].SetFocus

Dim varItem As Variant, strStates As String
For Each varItem In Me.lstStates.ItemsSelected
If strStates = "" Then
strStates = Me.lstStates.ItemData(varItem)
Else
strStates = strStates & vbCrLf &
Me.lstStates.ItemData(varItem)
End If
Next

Forms![usrfrmPricing]![usrfrmTakeoverClaims].Form!
[States] = strStates

End Sub

Each of the subforms is independent of the other. The
first tab subform works fine. The other 2 do not set
focus nor transfer the selected states. Above is one of
the non-working subforms code behind the transfer button
of the popup states form. I have another db that is
similar and that one works. Not sure what is wrong here.
LIke to have another pair of eyes look this over.
Thanks.
*** John
 
When setting focus to a control on a subform, I believe you need to do it in
two steps. Set focus to the subform control then set focus to the control on
the subform.

Forms![usrfrmPricing]![usrfrmTakeoverClaims].SetFocus
Forms![usrfrmPricing]![usrfrmTakeoverClaims].Form![States].SetFocus
 
Back
Top