find a record... combobox settings

Milothicus

Registered User.
Local time
Today, 08:44
Joined
Sep 24, 2004
Messages
134
I've tried comparing all the settings between a combobox that's set to find a record that matches the choice, and one that's just added on its own, and can't find any difference.

how is a combobox set to find a record? can it be done manually or is the wizard the only way?

not a pressing question, but i seem to be missing something......
 
If I understand the question correctly - Could you use the cboBox as a filter for the forms record source?

kh
 
you can change the way a combobox finds its values on the data tab of the properties. You can use a query (in the row source) for example as simple as you create normal queries.
2nd you can create a recordset and make that the source of a value list (is also a listbox only diff way of getting values in there)

search the forum and you will find many answers

Al
 
i have been searching the forums, but i can't find any discussion about looking up records without using the wizard, everyone just recommends using the wizard.

it just seems like there's one little thing i'm missing to make a combobox select a record without using the wizard...........
 
I am having the same problem

I have been trying to do something similar. As far as I understand from messing around with the combo box when you have a selection from a table this is completly independant of the table even when it is bound to a field.
So what I am assuming is that you have to tell it that when you select a value that you want it to go to that record in the table. Any ideas on how to do this?
 
I think i found the key.

I have a main table (table1) , and one field (client) is a lookup from another table (table2).

table2 has an index field (autonumber), a name field, an address field, and a phone field.
table1 has a lot of fields, but the important one is the client lookup field.

the form's record source is a query that includes client from table1, address from table2 and phone from table2

then the combobox's row source is:

SELECT table2.Index, table2.name FROM table2;

with column count =2 and widths= 0";1".

I attached a db to make it clearer.....

so this is how you make a combo find a record without using the wizard.....
and the combobox's control source is client

the important thing is that the control source is from table1, and the row source looks up the name and index on table2 (with the 2 columns and the widths).

does this make sense?
 

Attachments

Last edited:
Thanks, this information helped me out. Just as an aside you don't hapen to know how to force a new record to be created? I creat a new record using my form and I assumed at that stage a new id (an autonumber) would have been created but this does not seem to be the case.
 
I'm not 100% on this, but i believe you have to save the record before the new autonumber is recognized.

I'm still pretty new at this, but here's what i did: i made a button under the combo to add a new record to the table that the combo is referencing. the button opens a new form that asks for the details for (in my case) a new client. on the exit event, i have the following code:

DoCmd.SetWarnings (False)
DoCmd.RunCommand acCmdSave
Forms!New_Contact.Form!Client_FK.Requery
DoCmd.SetWarnings (True)

i can't remember which (if either) command had problems with setwarnings, so i just put it around both.

the button is on the form: New_Contact
and the combo box is Client_FK.

hope this helps.
 

Users who are viewing this thread

Back
Top Bottom