Query with combobox filter has unexpected results

Jaymin

Registered User.
Local time
Today, 23:28
Joined
Oct 24, 2011
Messages
70
Hi all,
Hope someone can explain what is going on.
I have a report, that gives a result from a query which is filtered by a combo box. -
Code:
Like [Forms]![frmStaffSelection].[cboStaffSelection] & "*"
what happens is that the combo box has a list of names, when you do not select anything in the combo box the report shows all the names for the report, when you select the second name or any other name from then on in the combo box, you get only the report for them, This where I am stuck-- :banghead:, if you select the first name in the list from the combo box it shows that name and about ten other names as well. (30 names in the database)
Their names are different and I cannot find why it selects just these other names,
if I remove the &"*" then I get a single report for each name and it works for all names, but the non- select option, so I can see all in a report will not work.
regards to all
 
if you select the first name in the list from the combo box it shows that name and about ten other names as well.
please provide some examples of what you are searching for and what results you get. Also what is the rowsource to your combobox (if using a query show the sql to the query, not just the name of the query, and if a table show the fieldnames of the table in order) and what is the bound column
 
should be:

Like '" & [Forms]![frmStaffSelection].[cboStaffSelection] & "*'"
 
Guys,
Thank you for a quick response, I forgot to bring the database home it is still at work and i will not be back till Friday, I will send the results to you replies then
many thanks
Peter :)
 
Hi All,
I have found out why I had this problem,
In my query fields there were "staffID", "StaffName", "yearID"
The
Code:
Like [Forms]![frmStaffSelection].[cboStaffSelection] & "*"
was placed in the "staffID" column and the form combobox referenced the first field which was the "StaffID", so when I selected the first staff name in the list of the combobox which had an ID number of 2, all records that had a 2 at the start e.g. 2, 22, 25 it appeared in the list of records.

So I changed the code to look at the "staffName" and changed the combobox to reference the "StaffName" instead and it all works
Thanks to all who helped
:rolleyes: :)
 

Users who are viewing this thread

Back
Top Bottom