var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Query Issue
I have a combo box using a datasource from a query the query is first name and a last name. When I have two names with the same surname, the combo box always enters another name with a lower alphabetical name with the same surname.
I selct Des on the combo boxs but it comes up with coby after selecting. This is only happening to ppl with the same surname.
I also have another combo box that queries just the surname which is working ok
This is because the value returned by the combo is the one of the first column.
I suppose that the rowsource of the combo is something like
When you select a row in the combo, only the first column (ie Name) is returned, so you get the first line where Name equals what you selected, in accordance to the sort order.
SELECT Name, Surname FROM Mytable ORDER BY Name, Surname;
The best practice to solve this problem is to add a key to your table, so it looks like this:
1 | Des | Galah
2 | Coby | Galah
Now you base your combo on a select statement including the key, like this:
Then you base your query on the value returned by the combo that now is Key, key being a unique value in the Mytable table.
SELECT Key, Name, Surname FROM Mytable ORDER BY Name, Surname;
Another solution would be to retrieve the values from the different columns of the combo using the syntax:
On this issue, see:
name = Combo.Column(0).Value
Surname = Combo.Column(1).Value
The Access Web - Welcome
Have a nice day!
I suspect faulty table design. The combo box should be bound to the person's ID, not their surname.
Owner and Manager of
. , Microsoft Access Development Specialists CypherBYTE
Microsoft Access . MCP
And all around nice guy! "Heck it's something understood by accountants ... so it can't be 'that' difficult..."
"...teach a man to code and he'll be frustrated for life! "