Query and auto fill

E

Esaw

I have posted this question before and not been able to figure out the issue,
so I'll try again.
I have a "autofill" set up in a subform using a combo box and text box. It
works just fine. But now that I need it to do the same thing in a query, I
don't know how to set it up. It's displaying the wrong field (primary
key/ID#) in the report and in the query only the StyleNumber.

Here is my query SQL:
SELECT Contracts.ArtistName, Contracts.StyleNumber,
Contracts.StyleDescription, Contracts.ClientName, Contracts.ContractStart,
Contracts.ContractEnd, Contracts.RoyaltyRate, Contracts.Product
FROM Art RIGHT JOIN Contracts ON (Art.StyleDescription =
Contracts.StyleDescription) AND (Art.StyleNumber = Contracts.StyleNumber)
ORDER BY Contracts.ArtistName, Contracts.ContractStart DESC;

And here is how it's set up in my subform:
Combo Box name is: ArtID
Control Source is: StyleDescription
Row Source is: SELECT [Art].[ID], [Art].[StyleNumber],
[Art].[StyleDescription] FROM Art ORDER BY [StyleNumber];
Format is: 3 columns, Column width 0",0.5",0"

Text Box Name is: StyleDescription
Control Source is: =[ArtID].[Column](2)

Could anyone help me out with this? I seem to be missing something.
Thanks!
 
J

Jeanette Cunningham

Hi,
I assume when a user selects a Style description in the combo, the form
shows all clients who purchased this art with this style description.
Correct me if I am wrong.
The SQL you posted sounds as if you are trying to get all the clients sorted
by the style description. Is this correct?
I set up 2 tables Art and Contracts as you described.
I put in some fictional data and made the query that fits the sql you
posted.
The query worked fine.

It sounds as if the combo and the sql both work fine, so the problem lies
with something else, although I have no idea where or what.
What is the record sourec for your form? Would you like to post the SQL for
it.

Jeanette Cunningham
 
J

Jeanette Cunningham

Hi, another thought, are you willing to post back which column is the bound
column of the combo called ArtID.
Jeanette Cunningham
 
E

Esaw

I actually want them sorted by StyleNumber. I had accidentally typed in Style
Description as the Control source for the Combo Box. It's actually
StyleNumber. The bound column on the combo box is 1.
Thanks for your help


Jeanette Cunningham said:
Hi, another thought, are you willing to post back which column is the bound
column of the combo called ArtID.
Jeanette Cunningham


Esaw said:
I have posted this question before and not been able to figure out the
issue,
so I'll try again.
I have a "autofill" set up in a subform using a combo box and text box. It
works just fine. But now that I need it to do the same thing in a query, I
don't know how to set it up. It's displaying the wrong field (primary
key/ID#) in the report and in the query only the StyleNumber.

Here is my query SQL:
SELECT Contracts.ArtistName, Contracts.StyleNumber,
Contracts.StyleDescription, Contracts.ClientName, Contracts.ContractStart,
Contracts.ContractEnd, Contracts.RoyaltyRate, Contracts.Product
FROM Art RIGHT JOIN Contracts ON (Art.StyleDescription =
Contracts.StyleDescription) AND (Art.StyleNumber = Contracts.StyleNumber)
ORDER BY Contracts.ArtistName, Contracts.ContractStart DESC;

And here is how it's set up in my subform:
Combo Box name is: ArtID
Control Source is: StyleDescription
Row Source is: SELECT [Art].[ID], [Art].[StyleNumber],
[Art].[StyleDescription] FROM Art ORDER BY [StyleNumber];
Format is: 3 columns, Column width 0",0.5",0"

Text Box Name is: StyleDescription
Control Source is: =[ArtID].[Column](2)

Could anyone help me out with this? I seem to be missing something.
Thanks!
 

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