Filtering Listbox based on Tab control (1 Viewer)

musclecarlover07

Registered User.
Local time
Today, 00:14
Joined
May 4, 2012
Messages
236
So I have a Tab control. Each tab is assigned to a specific user (which is controlled through another form). So If I assigned Page1 to Smith then Page1 caption reads Smith. Within each page is a list box that is filtered based on what name is in the caption. This works perfectly. My problem is I have another list box that is not within the tab control. I wan this to be filtered based on what tab is active. Both list boxes are bound to a query.
 

musclecarlover07

Registered User.
Local time
Today, 00:14
Joined
May 4, 2012
Messages
236
Nevermind I figured it out

So on the tab controls OnChange event I have the following code:
Code:
Dim ListFilter As String

Me.Text35 = Right(Me.ActiveControl.Name, 1)

ListFilter = "Select [qryDPM].[ID],[qryDPM].[CompanyName] " & _
                 "From qryDPM " & _
                 "Where Assigned ='" & DLookup("MemberName", "tblTabCtrl ", "ID =" & Me.Text35) & "'"
    Me.lstDPM1.RowSource = ListFilter
    Me.lstDPM1.Requery
This works beautifully
 

vbaInet

AWF VIP
Local time
Today, 06:14
Joined
Jan 22, 2010
Messages
26,374
So I have a Tab control. Each tab is assigned to a specific user (which is controlled through another form).
Just curious why the need for 1 form per user? Are these forms all identical with perhaps some minor layout changes? Do they all pull from the same source?
 

musclecarlover07

Registered User.
Local time
Today, 00:14
Joined
May 4, 2012
Messages
236
There isn't 1 form per person. I have a tab control with several pages. Everthing is on my main form (frmMain) then i have a tab control (TechnicianWork) with a potential 15 tabs. All named (Technician1, Tecninican2 etc) Within each tab is a listbox.

What I meant by that was that there is another form that controls what name goes into each tab captions. SO in frmTabCtlManger I have 15 drop down boxes (a continuous form) for each record (ONLY 15) and you select a name in the drop down box. When frmMain is opened it looks up each location and puts the corresponding name in to the tabs caption. Sorry for any confusion that may have caused
 

vbaInet

AWF VIP
Local time
Today, 06:14
Joined
Jan 22, 2010
Messages
26,374
Oh I see. I was just making sure your design was somewhat full proof.
 

Users who are viewing this thread

Top Bottom