Automatically populate a form field based on predefined table?

G

Guest

What I'm trying to do: If in a form, I enter a stock ticker (MSFT), I want
the Company Name (Microsoft) to automatically populate in the form based on a
table where I've got the tickers and Company Names defined.

My Tables are
Customers:
Ticker (Primary Key)
Contact Name
Price
etc

Company Names:
Ticker (not primary key)
Company Name

My Query in the design grid:
Ticker (from Customers)
Company Name (from Company Names)
Contact Name (from Customers)
Price (from Customers)
etc

where the join is Include all records from Company Names and only those
records from Customers where the joined fields are equal.

When I try to create a form based on this, I'm not getting it to
automatically populate. This is one of those "should be really easy but
isn't". Can someone help me figure out how to get the Company Name to
autopopulate in the form after the user enters the ticker?

Many thanks -
Jessica
 
G

Guest

should be easy as you say.

first I would verify that the query is returning results as you
expect.....that is the first sanity check....

then try re-creating a new form on that query with a combo or list box set
up via it's wizard to your ticker field....

shouldn't be complicated...
 
J

John Vinson

What I'm trying to do: If in a form, I enter a stock ticker (MSFT), I want
the Company Name (Microsoft) to automatically populate in the form based on a
table where I've got the tickers and Company Names defined.

My Tables are
Customers:
Ticker (Primary Key)
Contact Name
Price
etc
Company Names:
Ticker (not primary key)
Company Name

I think your primary keys are inappropriate, at least based on the
table names! Does each Customer have one and only one ticker, and if
one customer has MSFT is it appropriate that no other customer may
ever own MSFT? Or is MSFT - Microsoft Corp. - the customer?

Secondly, doesn't each Company have one and only one unique Ticker?

I'd expect Ticker to be the PK of the Company table, and not to be in
the Customer table at all (unless I'm misunderstanding the meaning of
"Customer").
My Query in the design grid:
Ticker (from Customers)
Company Name (from Company Names)
Contact Name (from Customers)
Price (from Customers)
etc

where the join is Include all records from Company Names and only those
records from Customers where the joined fields are equal.

When I try to create a form based on this, I'm not getting it to
automatically populate. This is one of those "should be really easy but
isn't". Can someone help me figure out how to get the Company Name to
autopopulate in the form after the user enters the ticker?

No. It shouldn't "automatically populate" unless there is data in both
tables. What isn't populating that you expect to?

What actually ARE the meanings of the two tables (in the real world)?
How are they related?

John W. Vinson[MVP]
 

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