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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 2003 qry wont read subform value 1

Status
Not open for further replies.

TwoOdd

Programmer
Sep 10, 2003
196
CL
First of all, let me start by saying that I'm fixing a problem on a database that I did not build and rewriting or changing the structure is not feasible. Also, this works when running the database in Access2002 or 2000, but not 2003.

I have a query that pulls criteria from a form, one of the criteria is pulled from a subform on the form. The problem is that the query pulls all values except the value from the subform. By the way, the value I want from the subform is in a combo box if that makes any difference. If I use only the criteria from the form (eliminate the value from the subform) the query works perfectly. I put a hidden field on the main form and when the button is clicked to execute the query, I set the value of the hidden field to the value on the subform and then pull the hidden fields value for the criteria and it works. In other words, I can capture the value in the subform using vba but not in the query. The query seems to be able to pull values only from the main form.

Any reason why and does anybody know how to fix it? As you can see, I have a workaround which is fine for one value, but one shouldn't have to duplicate every field from a subform just to pull the value into a query.

Thanks in advance for any help,


TwoOdd
--------------
Good judgment comes from experience, and experience comes from bad judgment.
-- Barry LePatner
 
How the query pulled the value from the subform ?
Like this ?
Forms!MainForm!NameOfSubFormCONTROL.Form!NameOfCombo

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
It's referenced as:

[Forms]![MainForm]![subform]![combobox]

TwoOdd
--------------
Good judgment comes from experience, and experience comes from bad judgment.
-- Barry LePatner
 
Got it. Thanks PHV.

TwoOdd
--------------
Good judgment comes from experience, and experience comes from bad judgment.
-- Barry LePatner
 
The correct syntax is:
[Forms]![MainForm]![subform][highlight].Form[/highlight]![combobox]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top