472,803 Members | 1,094 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,803 software developers and data experts.

Filter subform based on a query .

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 4516
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,534 Expert Mod 16PB
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
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 Expert 1GB
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,534 Expert Mod 16PB
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
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 Expert 1GB
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
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 Expert 1GB
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
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 Expert 1GB
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,534 Expert Mod 16PB
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 Expert 1GB
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
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
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
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
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
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
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
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
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
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
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.