is this possible in a list box?

G

Guest

I have a unbound form that has undound combo box and unbound listbox.... What
am doing is selecting an employees name from the combo box and the listbox is
populated with which months ( ie I formated the months as follows
=Format$([TrackDate],"mmmm yyyy",0,0))they worked stuff on.
When I click on an item from the listbox, it opens everyone elses stuff for
that month and not that just specific employee... this is the code I have for
opening the report
Private Sub List4_DblClick(Cancel As Integer)

Dim DocName As String

DocName = "Monthly Employee Tracking"

DoCmd.OpenReport DocName, acViewPreview, , "[Months]='" & Forms![Search
Monthly Employee]![List4] & "'"

End sub

The following is the sql statement that I have that the list box infor
contains!

SELECT DISTINCT Format$([TrackDate],"mmmm yyyy",0,0) AS Months,
Tracking.EmplID
FROM Tracking
GROUP BY Format$([TrackDate],"mmmm yyyy",0,0), Tracking.EmplID
HAVING (((Tracking.EmplID)=[Forms]![Search Monthly Employee]![cmbsrchEmpl]))
ORDER BY Tracking.EmplID;


Please help
 
G

Guest

It's doing exactly what you are asking it to, and that is to supply the items
in List 4 that match the selected month. Include the selected EmpId criterion
in your statement to narrow the display:

DoCmd.OpenReport DocName, acViewPreview, , "[Months]='" & Forms![Search
Monthly Employee]![List4] & " AND " & "[EmplID]= " & [Forms]![Search Monthly
Employee]![cmbsrchEmpl])) & "'"
 
G

Guest

Thank you so much, this worked so perfect!

smk23 said:
It's doing exactly what you are asking it to, and that is to supply the items
in List 4 that match the selected month. Include the selected EmpId criterion
in your statement to narrow the display:

DoCmd.OpenReport DocName, acViewPreview, , "[Months]='" & Forms![Search
Monthly Employee]![List4] & " AND " & "[EmplID]= " & [Forms]![Search Monthly
Employee]![cmbsrchEmpl])) & "'"

--
sam


JOM said:
I have a unbound form that has undound combo box and unbound listbox.... What
am doing is selecting an employees name from the combo box and the listbox is
populated with which months ( ie I formated the months as follows
=Format$([TrackDate],"mmmm yyyy",0,0))they worked stuff on.
When I click on an item from the listbox, it opens everyone elses stuff for
that month and not that just specific employee... this is the code I have for
opening the report
Private Sub List4_DblClick(Cancel As Integer)

Dim DocName As String

DocName = "Monthly Employee Tracking"

DoCmd.OpenReport DocName, acViewPreview, , "[Months]='" & Forms![Search
Monthly Employee]![List4] & "'"

End sub

The following is the sql statement that I have that the list box infor
contains!

SELECT DISTINCT Format$([TrackDate],"mmmm yyyy",0,0) AS Months,
Tracking.EmplID
FROM Tracking
GROUP BY Format$([TrackDate],"mmmm yyyy",0,0), Tracking.EmplID
HAVING (((Tracking.EmplID)=[Forms]![Search Monthly Employee]![cmbsrchEmpl]))
ORDER BY Tracking.EmplID;


Please help
 

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