Populating a field with data from a previous field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Here's the problem that I am having:

I have a table BnkPtnr Table with two fields BankPtnr ID and BankPtnr #. I've created a form POP form which has a field to select BankPtnr ID (combo box). Once I select the ID, I want the next field BankPtnr Name to be populated with the corresponding name but it doesn't. Here's what I've done so far

On POP Form, I've set BankPtnr # as a combo box with 2 columns, one for BnkPtnr # and one for BnkPtnr Name and I have the Row Source to select the 2 fields
Row Source
SELECT [BnkPtnr Table].[BnkPtnr #], [BnkPtnr Table].[BnkPtnr Name] FROM [BnkPtnr Table] GROUP BY [BnkPtnr Table].[BnkPtnr Name], [BnkPtnr Table].[BnkPtnr #] ORDER BY [BnkPtnr Table].[BnkPtnr Name]

Bound Column should is

However, I don't know what to do now for the name field. I've tried to set BnkPtnr Name as a text box with control source BnkPtnr # but it displays the number from BnkPtnr # (the previous field) and I've also tried to set it to BnkPtnr Name but nothing comes out

Can someone please help me.......
 
Hi Ana,
Assuming that you don't need to edit the name, and that it is just there to
show which partner is selected, you should be able to use the Column
property.

For the BnkPtnrName field, leave the countrol source blank.
For the bankPartnerID combo box, add code in the "After Update" event, that
says something like:
me.BnkPartnerName = me.bankPartnerID.Column(1)

That way, after each time the partner ID combo box is changed, it will take
the value from the second column and put it in the name box. (remember that
column 1 is the second column, since column(0) is actually the first column
in your combo box.

I hope that helps. Let me know if you have questions.

--
Andy Picton
(e-mail address removed)
AP Networking
www.apnetworking.com

Ana said:
Here's the problem that I am having:

I have a table BnkPtnr Table with two fields BankPtnr ID and BankPtnr #.
I've created a form POP form which has a field to select BankPtnr ID (combo
box). Once I select the ID, I want the next field BankPtnr Name to be
populated with the corresponding name but it doesn't. Here's what I've done
so far:
On POP Form, I've set BankPtnr # as a combo box with 2 columns, one for
BnkPtnr # and one for BnkPtnr Name and I have the Row Source to select the 2
fields.
Row Source:
SELECT [BnkPtnr Table].[BnkPtnr #], [BnkPtnr Table].[BnkPtnr Name] FROM
[BnkPtnr Table] GROUP BY [BnkPtnr Table].[BnkPtnr Name], [BnkPtnr
Table].[BnkPtnr #] ORDER BY [BnkPtnr Table].[BnkPtnr Name];
Bound Column should is 1

However, I don't know what to do now for the name field. I've tried to
set BnkPtnr Name as a text box with control source BnkPtnr # but it displays
the number from BnkPtnr # (the previous field) and I've also tried to set it
to BnkPtnr Name but nothing comes out.
 
Back
Top