Open Record with Condition

fenhow

Registered User.
Local time
Today, 07:39
Joined
Jul 21, 2004
Messages
599
Hi, I have a form that has a combobox and a tab control. The selection in the combobox determines which tabs are visible on current event.

On one of the tabs I have a search window, when the user double clicks on the name the focus moves to that record in one of the tabs.

What I am trying to do is determine which tab to open on double click. So for an example, if the combobox = Lease than it should open to tab 2, if combobox = Retail Sale then it should open to tab 4. I cannot seem to figure out how to apply that logic to this code that opens the record from my search box.

Any suggestions?

Fen

Private Sub lstItems2_DblClick(Cancel As Integer)
Dim RowNumber As Integer
RowNumber = Me.lstItems2.ListIndex + 1

Dim Customer, DNLID
Customer = (lstItems2.Column(0, RowNumber))
DNLID = (lstItems2.Column(1, RowNumber))

'Dim Response As Integer
'Response = MsgBox("Detail" & "ForMoreInformationclickok,vbOKCancel")

'If Response = vbOK Then
'If Combo432 = "Retail Sale" Then
DoCmd.OpenForm "frm_DriveNow_lease", , , "[DNLID]=" & lstItems2.Column(1)
With Forms("frm_DriveNow_lease")
!TabCtl267.Value = 2
End With
'Else
'End If

End Sub
 
Page in Tab control are 0 based (if you did not set Option Base 1), meaning the first Tab is actually Tab(0):
Code:
Private Sub lstItems2_DblClick(Cancel As Integer)

    With Me
        If .lstItems2 = "Lease" then
            ' zero based so 0 is actually 1, 1 is to, etc.
            .TabCtl267.Pages(1).SetFocus
        End If
        If .lstItems2 = "Retail Sales" then
            .TabCtl267.Pages(3).SetFocus
        End If
    End With
        
End Sub
 

Users who are viewing this thread

Back
Top Bottom