473,385 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Search Query doesn't work with combo box

11
I have a search query set up to search whatever value is present in a combo box in my search form. I also have a text box that holds the same function as the combo box.

When I enter a value in my text box the search query will return a list of records, however if I select the exact same value from the drop-down list of the combo box, the search query will not return any records.

The list that makes up the combo box is from imported external data from an excel document could this be a factor in the issue?
Thanks for taking your time to read this.
Mar 2 '15 #1
7 4560
twinnyfo
3,653 Expert Mod 2GB
amwkl4,

You haven't shown us the queries you are using, so it is impossible to troubleshoot at this point.

Also, the Text Box and Combo Boxes "could" have different values, depending on how you have established the RowSource for your Combo Box. Please provide the Query used to populate your Combo Box as well.

Then, we can take a look and see what you have.
Mar 2 '15 #2
Seth Schrock
2,965 Expert 2GB
I would guess that the combo box is bound to a hidden field so you are really searching for the text that you think that you are. Look at the Row Source for the combo box. This will tell you what fields it is pulling. Then look at your Column Widths property. The width for each field in the row source is listed, separated by a semi-colon. If the first width is set to 0, then you won't see the first field in your row source and thus the value that you are selected isn't what is getting searched for in your form.
Mar 2 '15 #3
amwkl4
11
Seth,

I think you are right, the combo box has a hidden column for ID (Primary Key). Is there any way I can select only the keywords column and exclude the ID column?
Mar 2 '15 #4
amwkl4
11
I got it working now, I just created another table with the keywords column as the primary key so there are no hidden fields. The search query is functioning properly.
Mar 2 '15 #5
Seth Schrock
2,965 Expert 2GB
You can change the Bound To property to make it be the keywords column instead of the ID column. So if you only have those two fields, then change the property to 2.
Mar 2 '15 #6
twinnyfo
3,653 Expert Mod 2GB
You can also refer to the second column in the list by referring directly to it:

Expand|Select|Wrap|Line Numbers
  1. Me.cboComboBox.Column(1)
However, if you are searching for the text instead of the index, I would guess that your database is not fully properly normalized. See this topic for details: Database Normalization.
Mar 2 '15 #7
NeoPa
32,556 Expert Mod 16PB
TwinnyFo:
However, if you are searching for the text instead of the index, ...
I would suggest you are far better off filtering based on the ID than you are on the text. Text is what humans would use but computers find the IDs so much easier and more reliable to work with.
Mar 2 '15 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Station Media | last post by:
Hi, here my problem, i use stored procedure in ACCESS database(latest version), and i would like to use this procedure but it doesnt work, do you know why ? Procedure: PARAMETERS MyField Text...
4
by: DL | last post by:
Hi, I'm using this query in VBA: SQL_Str = "SELECT pid FROM registratie WHERE datum=#" & Forms!TijdReg. & "# AND pid='"& CurrentUser() & "' " im using it like this: Set dbs = CurrentDb...
1
by: SC | last post by:
I'm developing a site that may eventually have a very large database of users (hopefully, but who knows). It will be a community website where users can search each other (think Friendster,...
0
by: Juna | last post by:
I have been working in vs2003, but now started to work in vs2005 but the problem, I have simple web application not website, which work i mean open in browser when we press F5 or run the...
2
by: rob21century | last post by:
Hello i will be a web designer one day but until then i need a little help I have a search query that searches the database for user entered string. See below: $query = "SELECT * From MyTable...
1
by: Grubsy4u | last post by:
Grubsy4u Newbie 7 Posts October 5th, 2007 11:31 AM #1 Report calculations --------------------------------------------------------------------------------
2
by: fran7 | last post by:
Hi, I have this search query 'search feature If Request("SearchWord") <> "" Then strWd=Replace(Request("SearchWord"),"'","''") strSQL="Select...
2
by: suckyboy | last post by:
Hi, I have a small problem here. When I search up a search form without a Combo box, the search works fine and display all the results. However, when I setup a search form with a Combo Box, the...
4
by: CLSkcab | last post by:
Background: Frontend- MS Access 2010/VBA Backend- MS SQL Server 2008 DB02001 Table (Parent) SupplierID int (primary key) Supplier varchar(50) . . DB02003 Table (Child)
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.