Form and combo box problems (1 Viewer)

neileg

AWF VIP
Local time
Today, 13:47
Joined
Dec 4, 2002
Messages
5,975
I'm going mad here! How come I can do hard things, and get defeated by the trivial!

I have a simple form with a combo box containing a userID and a user name. This is based on a query.

I have a subform based on a parameter query that picks the the value from the combo box and displays the results as a continuous form.

This all works as expected, except...
If I select a user in the combo where there is no linked record in the query that feeds the subform, the first record in that query has its foreign key changed to match the user selected.

Separate from this problem, how do I get the combo box to show a blank when I open the form. I have a record in the underlying query that has a blank user name, but I can't seem to get this to be the default record to be displayed.
 

dcx693

Registered User.
Local time
Today, 08:47
Joined
Apr 30, 2003
Messages
3,265
If I select a user in the combo where there is no linked record in the query that feeds the subform, the first record in that query has its foreign key changed to match the user selected.
That's strange. What is the query that feeds the subform? How does the subform pick up the value in the combo box?

how do I get the combo box to show a blank when I open the form.
Use code like this: Me.cbo="" that will set that value of the combo box to a zero-length string. That will only work if the "bound" column in the combo box is the one containing the usernames.
 

neileg

AWF VIP
Local time
Today, 13:47
Joined
Dec 4, 2002
Messages
5,975
Thank you! Your question made me re-examine my setup. What do I find? I had named the control the same as the field in the query that feeds it. I know that this causes problems, so why did I do this???

Strange behaviour now solved.

Changing this also solved the other question. I feed the combo with a query sorted in alpha order. My blank name entry is first in this sort, so this now is the default display.

Just great to ask these questions where people can understand. Our IT support guys just shrug.
 

Users who are viewing this thread

Top Bottom