G
Guest
Hi,
I just wanted an advice from somebody:
I've got 2 fields on my form "Orders" - a combobox with Names, which I
select from table T_Names and a textbox for Addresses, which I want to be
filled up automatically from the second column of the same T_Names table when
the "Name" matches. The values that I enter are stored in the T_Orders table.
The point is the Names field is not limited to list and the Addresses field
is not limited to list. So I want to be able to enter any Name and any
Address. But when the name is from the list - I want the address to be filled
into the textbox automatically.
So I used the following update querry for the "on exit" event for "Names"
combobox:
UPDATE T_Orders, T_Names SET T_Orders.Address = T_Names.Address
WHERE (((T_Orders.ID)=Forms!Orders.ID) And
(Forms!Orders![Name]=T_Names.Name));
This seems work all right, but now I want the new names which are not on
list to automatically be added to my T_Names table, so that next time they
also appear on the list.
Is it going to be another update query which compares "Names" values from 2
tables and adds new values to my T_Names table?
I am also not sure that I know exactly the way how to do it.
The other way I was thinking about is instead of using T_Names table for my
combobox, to make some query, which would lookup values in my T_Orders table
in the Names field and select only the unique names, not including
duplicates, so the list for the combobox would be some 20 Names instead of
200.
This "duplicate" thing is also seem to me so complicated.
Can somebody advise me on a better way to organize this?
I would appreciate any help.
Thank you.
Lana
I just wanted an advice from somebody:
I've got 2 fields on my form "Orders" - a combobox with Names, which I
select from table T_Names and a textbox for Addresses, which I want to be
filled up automatically from the second column of the same T_Names table when
the "Name" matches. The values that I enter are stored in the T_Orders table.
The point is the Names field is not limited to list and the Addresses field
is not limited to list. So I want to be able to enter any Name and any
Address. But when the name is from the list - I want the address to be filled
into the textbox automatically.
So I used the following update querry for the "on exit" event for "Names"
combobox:
UPDATE T_Orders, T_Names SET T_Orders.Address = T_Names.Address
WHERE (((T_Orders.ID)=Forms!Orders.ID) And
(Forms!Orders![Name]=T_Names.Name));
This seems work all right, but now I want the new names which are not on
list to automatically be added to my T_Names table, so that next time they
also appear on the list.
Is it going to be another update query which compares "Names" values from 2
tables and adds new values to my T_Names table?
I am also not sure that I know exactly the way how to do it.
The other way I was thinking about is instead of using T_Names table for my
combobox, to make some query, which would lookup values in my T_Orders table
in the Names field and select only the unique names, not including
duplicates, so the list for the combobox would be some 20 Names instead of
200.
This "duplicate" thing is also seem to me so complicated.
Can somebody advise me on a better way to organize this?
I would appreciate any help.
Thank you.
Lana