UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Filter A Query Based On An Open Subform Value, Access 2007    
 
   
ektorakos
post Mar 20 2017, 06:39 AM
Post#1



Posts: 83
Joined: 8-September 16



Hello everyone,

I have a small problem.

I need to filter a query based on a form control.

I have done this multiple times using this in the criteria of the query field
forms![frmname]![cboA]

this works perfectly.

The problem is that now i need to filter the query based on the Subform control and this doesnt work

Is it possible to express it differently so that it works??


thaaaanks!!!


Go to the top of the page
 
ektorakos
post Mar 20 2017, 07:01 AM
Post#2



Posts: 83
Joined: 8-September 16



I will reply to myself for others to see

Forms![frmname]![subformname]![control]

thanks Ektorakos you are the best developer in the world (not)
This post has been edited by ektorakos: Mar 20 2017, 07:01 AM
Go to the top of the page
 
Larry Larsen
post Mar 20 2017, 07:02 AM
Post#3


UA Editor + Utterly Certified
Posts: 24,085
Joined: 26-August 02
From: Melton Mowbray,Leicestershire (U.K)


Hi
You may find the right reference here.. Refer to Form and Subform properties and controls

For these examples:

Mainform is the name of the top level form

Subform1 is the name of the subform CONTROL on mainform

Subform2 is the name of the subform CONTROL on the 1st subform.

HTH's
thumbup.gif

--------------------
"Time...We have exactly the same number of hours per day that were given to Helen Keller, Pasteur, Michaelangelo, Mother Teresa, Leonardo da Vinci, Thomas Jefferson, and Albert Einstein"
H. Jackson Brown
Go to the top of the page
 
cheekybuddha
post Mar 20 2017, 07:02 AM
Post#4


UtterAccess VIP
Posts: 9,063
Joined: 6-December 03
From: Telegraph Hill


The main thing here ids to realise that the subform container control may have a different name than the actual subfom that it contains.

The syntax you need is:
[Forms]![frmname]![NameOfSubformControl].[Form]![NameOfControlOnSubform]

See here for a comprehensive reference

To find out the name of the subform control, in design view, click on the very edge of the control - it can take a few goes to get it right!

hth,

d

--------------------


Regards,

David Marten
Go to the top of the page
 
RAZMaddaz
post Mar 20 2017, 08:25 AM
Post#5


UtterAccess VIP
Posts: 9,429
Joined: 23-May 05
From: Bethesda, MD USA


PMFJI.....


Another way you can get the name of the Sub Form is the following steps:

1. Have the Main Form/Sub Form open.
2. View the Query and click in the Criteria of the related Field.
3. Click on your Right mouse button and select Build.
4. The Expression Builder will appear and the Expression Elements should be on the left side.
5. In the Expression Elements you should see your File/Database name, click on the plus button next to the name of the Database name and it will expand.
6. Now click on the plus button next to the Forms and then Loaded Forms.
7. Then you will see your Main Form name, in which you will click on the plus button and you should see the Sub Form name.
8. Finally, when you click on the Sub Form name you will see everything in the Sub Form, such as the Fields, Text Boxes, etc.
9. Double-click on the Text Box that you want to use in the Sub Form for the Criteria and it will appear in the Expression window, in the top area.
10. Then click "OK" and this will FINALLY appear in the Criteria area.

Make sure you have a greater than, less than or equal before this in order for you to get what you want.

RAZMaddaz
Go to the top of the page
 
ektorakos
post Mar 20 2017, 09:58 AM
Post#6



Posts: 83
Joined: 8-September 16



thank you all!
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    27th July 2017 - 09:31 PM