473,503 Members | 12,103 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Filter subform based on a query .

25 New Member
Hello ,

I am using MS Access 2007. Now if i ve a subform based on a table, filtering the subform is extremely easy . I only ve to click the relevant column head on the subform and check/uncheck the required records (clicking on the column head would yeild a drop down list).

However , since my subform is based on a query , i cannot avail the filter option using the above method. I get the error no 3075.

Can somebody please help me here,

Thanks a lot.

Regards,

Shreyans.
Oct 4 '07 #1
13 4672
shreyansghia
25 New Member
Also , as an alternate what i can do is have a combo box on the main form. The combo box will have for example purchase order no. So i should see only those records in subform which bears the purchase order no as i ve selected from the combo box.

Is this possible?

Thanks in advance.
Oct 5 '07 #2
NeoPa
32,557 Recognized Expert Moderator MVP
Check out Example Filtering on a Form. and see if that helps.
Otherwise your explanation doesn't really give much information.
Let us know if you need more help with this.
Oct 5 '07 #3
shreyansghia
25 New Member
Check out Example Filtering on a Form. and see if that helps.
Otherwise your explanation doesn't really give much information.
Let us know if you need more help with this.
Well NeoPa thanks for the above link . I could nt explain my requirement precisely earlier because i think it is really very complicated.

Anyways i would be really greatful if u could provide me with any link as how do i filter a subform when i make any selection from a combo box which would be on the main form.
Oct 7 '07 #4
puppydogbuddy
1,923 Recognized Expert Top Contributor
Well NeoPa thanks for the above link . I could nt explain my requirement precisely earlier because i think it is really very complicated.

Anyways i would be really greatful if u could provide me with any link as how do i filter a subform when i make any selection from a combo box which would be on the main form.
this code goes on main form...YourSubformControlName is the name of the subform container, not the subform (i.e. the source object).

Expand|Select|Wrap|Line Numbers
  1. Private Sub YourComboName_AfterUpdate()
  2. Me!YourSubformControlName.Form!YourComboName.Requery
  3. End Sub
See this link:
http://www.mvps.org/access/forms/frm0031.htm
Oct 7 '07 #5
NeoPa
32,557 Recognized Expert Moderator MVP
Well NeoPa thanks for the above link . I could nt explain my requirement precisely earlier because i think it is really very complicated.

Anyways i would be really greatful if u could provide me with any link as how do i filter a subform when i make any selection from a combo box which would be on the main form.
So providing the question is too much trouble but you'd like us to work in the dark and give you an answer anyway.
Priceless.
This without even bothering to check out the link already provided.
Oct 7 '07 #6
shreyansghia
25 New Member
So providing the question is too much trouble but you'd like us to work in the dark and give you an answer anyway.
Priceless.
This without even bothering to check out the link already provided.

Hmm , this is what i ve typed in the after update event of the combo box.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo33_AfterUpdate()
  2.  
  3. Me![DeliverySchedule subform].Form!Combo33.Requery
  4. End Sub
So when i select my desired option from the combo box, what i get is
run time error 2465. It also says that combo33 cannot be located .
Oct 8 '07 #7
puppydogbuddy
1,923 Recognized Expert Top Contributor
Hmm , this is what i ve typed in the after update event of the combo box.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo33_AfterUpdate()
  2.  
  3. Me![DeliverySchedule subform].Form!Combo33.Requery
  4. End Sub
So when i select my desired option from the combo box, what i get is
run time error 2465. It also says that combo33 cannot be located .
My fault.Combo33 is on the main form, not the subform:

Me!Combo33.Requery
Oct 8 '07 #8
shreyansghia
25 New Member
My fault.Combo33 is on the main form, not the subform:

Me!Combo33.Requery
Ok i incorporated the change suggested by u. What i get now is error 438 ; 'object does'nt support the property or method'. :-(.
Oct 8 '07 #9
puppydogbuddy
1,923 Recognized Expert Top Contributor
Ok i incorporated the change suggested by u. What i get now is error 438 ; 'object does'nt support the property or method'. :-(.
That should have worked, Please post the sql you have for the row source for combo33.
Oct 8 '07 #10
shreyansghia
25 New Member
That should have worked, Please post the sql you have for the row source for combo33.
Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT [DeliverySchedule].[InvoiceNo]
  2. FROM DeliverySchedule
  3. ORDER BY [InvoiceNo];
Oct 9 '07 #11
puppydogbuddy
1,923 Recognized Expert Top Contributor
Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT [DeliverySchedule].[InvoiceNo]
  2. FROM DeliverySchedule
  3. ORDER BY [InvoiceNo];

1.change the row source for your combo to the following:

Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT [DeliverySchedule].[InvoiceNo]
  2. FROM DeliverySchedule
  3. WHERE [InvoiceNo] = Me!Combo33
  4. ORDER BY [InvoiceNo];
You can use Me!Combo33 if you create the row source using vba behind the form. If you create the row source via the property sheet, then you have to use a fully qualified reference>>>Forms!YourMainForm!Combo33

2. Requery the combo in the combo's afterupdate event as previously discussed.

3. Make sure you have set the master & child links in the subform control to InvoiceNo.
4. If InvoiceNo is unique in the DeliverySchedule table, then you should eliminate the word Distinct from the select statement you used for combo33.
Oct 10 '07 #12
NeoPa
32,557 Recognized Expert Moderator MVP
PDB,

I don't think you can use the = Me!Combo33 version within SQL (even when embedded in a control's properties). The fully-qualified reference would be needed I'm afraid.
Oct 11 '07 #13
puppydogbuddy
1,923 Recognized Expert Top Contributor
PDB,

I don't think you can use the = Me!Combo33 version within SQL (even when embedded in a control's properties). The fully-qualified reference would be needed I'm afraid.
Hi NeoPa,
I was not sure......that is why I provided the long and short references. Thanks for confirming that for me.

PDB
Oct 11 '07 #14

Sign in to post your reply or Sign up for a free account.

Similar topics

1
7830
by: Robert Neville | last post by:
I would like to add filter functionality to my database whether through the Main form or the subform. This question may be rudimentary, yet I have not less experience with filtering data outside...
2
9772
by: Andante.in.Blue | last post by:
Hi everyone! I was wondering if there is a away to use Access 97's build in filter-by-form function but restrict its effect to just the subform. I have a parent form that shows the major...
0
2725
by: Colin | last post by:
In access 2000 I need to filter records in a Subform by pushing a button on a command button located on the Main form. The Main form is blank. Its only purpose is to contain the subform which is...
3
2749
by: Tony Williams | last post by:
Sorry to repost but I cannot work this out. Can anyone come up with a suggestion? I have a main form based on Table1. The form has a tab control of three pages. Each page has a subform based on a...
3
11937
by: dhowell | last post by:
In reading some of the posts on this group, it appears as though it is not strait forward at all to filter a form, which has subforms, by criteria which are either on subforms or span more than one...
14
4070
by: Anja | last post by:
Hi everyone, I have a sub form that references a query to get the results. However, what I want to do is filter the results further based on a certain criteria. How can I tell the sub form to...
9
15826
by: natwong | last post by:
Hi All, I'm a newbie in terms of Access and some of its functionality . I've been stuck on this problem for a couple days, even after searching the Web, etc. Currently I have five combo boxes...
2
4188
by: Matthew Wells | last post by:
Hi there. I am a programmer for a living, but this problem has my whole team stumped. I have a subform based on a query. I'm not using the "LinkMaster/ChildFields" properties ( I have my...
2
8599
by: cluless | last post by:
I'm relatively new to access, and I'm trying to create a form where if I click on a selection of a list box the subform below it will be filtered automatically on click (I was hoping I didn't need a...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7296
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7364
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7470
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5604
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1524
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.