Here is the complete sub for List48. I removed some semi colons and
re-wrote the where clause.
You should be able to copy and paste this without worrying about line
breaks.
----------------------
Private Sub List48_AfterUpdate()
Me.List28.RowSource = "Select [Team Leaders].[Team ID], " _
& "[TeamLeaders].[Team] " _
& "FROM [Team Leaders] " _
& "Where [tblCallCenters].[CallCenterID] = """ & Me.List48 """ " _
& "Order By "[TeamLeaders].[Team]"
End Sub
-----------------------
I strongly suggest that you rewrite the code in a way that will help you
to debug it-->
-----------------------
Private Sub List48_AfterUpdate()
Dim strSQL As String
strSQL = "Select [Team Leaders].[Team ID], " _
& "[TeamLeaders].[Team] " _
& "FROM [Team Leaders] " _
& "Where [tblCallCenters].[CallCenterID] = """ & Me.List48 """ " _
& "Order By "[TeamLeaders].[Team]"
Debug.Print strSQL
Me.List28.RowSource = strSQL
End Sub
-----------------------------
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
Issachar5 said:
Yes I fixed that now I get a message that highlights the FROM saying it
is
the expected end of statement
Private Sub List48_AfterUpdate()
Me.List28.RowSource = "Select [Team Leaders].[Team ID], [Team
Leaders].[Team] FROM [Team Leaders]; Where"
[tblCallCenters].[CallCenterID], [tblCallCenters].[CallCenterName] FROM
[tblCallCenters]; = """ & Me.List48 """ "
End Sub
Jeanette Cunningham said:
For a text field it is often easier to use 3 double quotes instead of a
single quote followed by a double quote.
replace this-->
'" & Me.List48 "'"
with this-->
""" & Me.List48 & """ "
Expanded to be clearer-->
3 double quotes before the &Me.
and 3 double quotes after the 8 &
followed by one more double quote at the end of the line.
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
Thank you so much for your assistance can you take a look at this code
and
tell me what I am doing wrong. I keep getting Syntax Error or high
light
yellow around '" & Me.List48 "'"
Me.List28.RowSource = "Select [Team Leaders].[Team ID], [Team
Leaders].[Team] FROM [Team Leaders]; Where "
tblCallCenters.CallCenterID = '" & Me.List48 "'"
:
Yes, I left out something on that line.
I left out -->
<space> & " <space>
Replace this line-->
& "Where TableWithTeamLeadInfo.CallCenterID = " & CallCenterListBox "
_
with this-->
& "Where TableWithTeamLeadInfo.CallCenterID = " & CallCenterListBox &
" "
_
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
Ok maybe I think I am not doing this right at all, my code keeps
turning
red
and it keeps jumping to the where and saying this is the end of the
statement. I am not good with codes, so have patience with me. In
your
statement shouldn't I brackets somewhere, I did exactly how you
have it
and
it doesn't work.
:
Hi Julius,
something like this air code will set up listbox 2 after user
makes a
selection in listbox 1.
-->
Dim strSQL As String
strSQL = "Select TeamLeadID, TeamLeadName " _
& "From TableWithTeamLeadInfo " _
& "Where TableWithTeamLeadInfo.CallCenterID = " &
CallCenterListBox "
_
& "OrderBy TableWithTeamLeadInfo.TeamLeadName "
Debug.Print strSQL
Me.TeamLeadListBox.RowSource = strSQL
-------------
Note: I am guessing the names of your table, fields and listboxes.
Replace TeamLeadID,TeamLeadName, TableWithTeamLeadInfo,
CallCenterID,
CallCenterListBox, TeamLeadListBox with the correct names for your
database.
Each listbox will need to have its first column as the bound
column.
The first column of each listbox will need to have the width of
its
first
column set to 0.
If you get duplicate team leader names in your listbox you may
need to
change the first line of strSQL to this-->
strSQL = "Select Distinct TeamLeadID, TeamLeadName " _
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
I have 3 list boxes I am using on a form, I need list box 3 to
reference
List
box 2, and List box 2 to reference List Box 1. So in other
words
when
I
hope
the form List box 2 and three are blank, when I selet a call
center
in
List
box 1, it populates my Team Leader List in list box 2, then when
i
select
a
Team leader in list box 2, it displays the agents for that Team
leader
in
list box 3. No so far I have already built the form I put the
list
boxes
in
their respective places this is where I get lost
Select Field1, Field2 From TableName Where FieldName =
Forms![FormName]![ListBoxAName]
I got that from another question somebody else asked. Can
someone
explain
this to me as if I was a four year old. If I was too confusing
then
just
explain how do I referenc box 3 to 2 and 2 to 1.