Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with subform combo box

Status
Not open for further replies.

clifftech

ISP
Nov 9, 2001
111
US
I have a subform2 table that is used for entering data. One of the subform2 fields needs data from a table used in (subform1) based on a value in the Main Datsa Entry and subform1 tables. I would like to have a drop down box on the subform2 field that allows the user to select a value based a query to the subform1 table which takes a value from the main form table.

The code that I am using in the subform2 row source field is as follows:

SELECT tblProject.Job_ID FROM tblProject WHERE (((tblProject.ProjClient_ID)=Forms![Main Data Entry]!Client_ID));

I'm sure the query is correct but it is not showing data in the drop down box.

Please help.



 
How is your subform bound to the original form?

Good Luck,

Alex

Professor: But what about your superintelligence?
Gunther: When I had that there was too much pressure to use it. All I want out of life is to be a monkey of moderate intelligence who wears a suit. That's why I've decided to transfer to Business School.
Professor: NOOOOOOOOOOOO.
 
Can you be more specific?

What is the subform's data source?

Professor: But what about your superintelligence?
Gunther: When I had that there was too much pressure to use it. All I want out of life is to be a monkey of moderate intelligence who wears a suit. That's why I've decided to transfer to Business School.
Professor: NOOOOOOOOOOOO.
 
Here's where I confused on how this works.

I'm trying to get the datasource for subform2 to be based on a query that gets the Client_ID from what is currently showing in the main form (Forms![Main Data Entry]!Client_ID and the Project_ID's that are showing in subform1.
 
you need to either build the query and save it, and enter the name in the data source property of your form, or write an SQL Statement and place that in data source property. Something like this:
Code:
SELECT * FROM [COLOR=red]Table[/color] WHERE [COLOR=red]field[/color] =Forms![COLOR=red]FormName!ControlName[/color];

Everything in red will be changed to reflect your particular application. And try to stay away from using the *.

Hope this will get you on the right track,

Alex

Professor: But what about your superintelligence?
Gunther: When I had that there was too much pressure to use it. All I want out of life is to be a monkey of moderate intelligence who wears a suit. That's why I've decided to transfer to Business School.
Professor: NOOOOOOOOOOOO.
 
Does the query go in the Control Source or the Row Source for the field in subform2?
 
For the form, it would be record source. For the combo box (drop down) you would set it as your Row Source, and specify 'Table/Query' as your Row Source Type.

Hope this helps,

Alex


Professor: But what about your superintelligence?
Gunther: When I had that there was too much pressure to use it. All I want out of life is to be a monkey of moderate intelligence who wears a suit. That's why I've decided to transfer to Business School.
Professor: NOOOOOOOOOOOO.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top