ANI File and Contacts are two different tables. I have a form that reads
information from the ANI File and displays it, I also have the Save & New
command on the form which goes to the new record row on the ANI File. There
is a field on the form "Customer" which reads from the Contacts.Company field
in the Contacts table. What I would like is for the Address field on the form
to be automatically populated with the address of the Company that is
selected in the "Customer" field. So, the way I was able to get the combobox
to display this address correctly is with the SELECT statement from my
previous post. The problem is, even though it displays the address in the
dropdown box, it is not selected by default. I did try a couple of things.
First, I tried where the combo box was bound to the Address field in the ANI
File while reading information from the Contacts.Address field based on the
customer selected in the Customer Field. It displayed the address correctly
but I had to manually click on the drop down arrow to actually select it.
Second, I tried making the combobox unbound and then making a separate Text
field and set the default value of the text field to
[ComboBoxName].ItemData(1). It would grab the information from the Combobox
but it would not refresh the information as the Combobox updated. I tried
creating a requery macro but I don't seem to have that working.
Steve Schapel said:
Justin,
I'm a bit lost at this point, I'm afraid?
First of all, what is "[ANI file].[Customer]"? There does not appear to be
a [ANI File] table or query included in your query?
Does this always only return 1 row? And this value will always be entered
in the combobox? In that case, what is the purpose of the combobox?
Is the combobox bound?
Sorry, just can't quite grasp what you are trying to do.
--
Steve Schapel, Microsoft Access MVP
Justin Roby said:
I have tried that but I obviously didn't put the correct value in the
default
value property, what would it be? Here is my Row Source value = SELECT
[Contacts].[Address] FROM Contacts WHERE [ANI
File].[Customer]=[Contacts].[Company];