lookup value on form in a table

G

Guest

I've been reading through some of the posts, and I know this has been
answered, but it's a little confusing when you're using different field
names. Here is what I'm trying to do.

In my form, I have a combo box called [Parent Company] & a text box called
[GID]. The [Parent Company] is a pull down list that is looking up values
off a table called [Company Names]. In my [Company Names] Table there are
only two columns, one is "parent company" the other is "GID". Each company
name has a GID associated with it. What I would like is when someone chooses
a company name from the [Parent Company] Combo box, then the [GID] text box
automatically fills in the GID number off the [Company Names] Table. I'm
guessing this will need to have a Dlookup function, but what would the
equation be.

I hope this makes sense.
 
J

Joan Wild

Matt said:
I've been reading through some of the posts, and I know this has been
answered, but it's a little confusing when you're using different field
names. Here is what I'm trying to do.

In my form, I have a combo box called [Parent Company] & a text box called
[GID]. The [Parent Company] is a pull down list that is looking up
values
off a table called [Company Names]. In my [Company Names] Table there are
only two columns, one is "parent company" the other is "GID". Each
company
name has a GID associated with it. What I would like is when someone
chooses
a company name from the [Parent Company] Combo box, then the [GID] text
box
automatically fills in the GID number off the [Company Names] Table. I'm
guessing this will need to have a Dlookup function, but what would the
equation be.


I'm assuming the name of the controls on your form are Parent Company and
GID; so change the following to match the name of the controls on your form.

To get the exact information using your field names and proper syntax, you
need to post what is in the Row Source of Parent Company and what the bound
field is.

I'm assuming the Row Source is SELECT GID, [Parent Company] FROM [Company
Names];
and that the Bound Column is 1.

GID should be unbound - set it's Control Source to
=[Parent Company].[column](0)

Another option is to not have a separate textbox for GID. Change the Row
Source of the combo box to
SELECT [Parent Company] & " - " & [GID] AS Expr1, GID FROM [Company Names];
Set the Bound Column to 2, and change the column widths to 2";0" (modify the
2" to suit).

Then you'd have a single combo box that shows both pieces of information.

If my assumptions are wrong, post back with the details.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top