Filter using optiongroup does not work in the subform

F

Frank Situmorang

Hello Experts:

I have tried my best and it still not work. Following is my VBA in the
mainform, wanted to filter by supplier:
Private Sub CboSupName_AfterUpdate()
Filter = "SupName='" & Me!CboSupName.Value & "'"
FilterOn = True
End Sub

In the suborm, I have put the option group like the one in the Cutomerphone
list of Northwind, but it does not work.


We apprediate your help.

Frank
 
O

Ofer Cohen

What the CboSupName RowSource include?

If the name is on the second column

Select SupId , SupName From TableName

then try
Me.Filter = "SupName='" & Me.CboSupName.Column(1) & "'"

If you want to filter by the supplier id and it is numeric field then drop
the single quote

Me.Filter = "SupName=" & Me.CboSupName
 
F

Frank Situmorang

Thank Ofer for your quick response, I have the following in the Cbo SupName
property:
Data tab:
Control source: SupName:
Rowsource type: Table/Query
Row Source:SELECT SupName FROM Suppliers;
Bound Column: 1
Limit to List: No

And this is the event prcedure:
Private Sub CboSupName_AfterUpdate()
Me.Filter = "SupName='" & Me.CboSupName.Column(1) & "'"
FilterOn = True
End Sub

My SupNo is alpha numeric

But It is still not work.
Anyway can I email you so that I can send the picture of my form, may be it
will be easyier to understand the problem. As I mentioned that I have a
filter on the subform, with purpose after I filter by supplier than I will
filter it again by outstanding only, paid only, and show all, other wise it
will be very long scroling down 'for huge transactions.

I appreciate your help.

Frank
 
F

Frank Situmorang

OK Ofer, thankyou very much, it works now for filtering the supplier name in
the main form, my fault is in the form allow edit should be Yes, it was No
before. May be when I changed it to No for certain users I forget to retun it
back.

Now the 2nd problem is for the subform. After I filter for a supplier, it
shows all invoicess details for that supplier. This should form takes data
from Invoice table which is linked to the supplier, by supplierNo.

I already made 3 buttons with the Option group (similar with the northwind
sample database). There are 3 button:

1 OutstandingOnly for option value=1
2. Paid Only = 2
3, ShowAll =3 as a default value

In the Grid macro, I put
OutstadingOnly if the SelectRecordsFilter=1 where PayDate is null
Paid Only if the SelectRecordsFilter=2 where PayDate is not Null
While show all is SelectRecordsFilter=3 will have action "Show all record"

My problem when I click it asked us to fill in the parameter and the data
filter is not correct.

Could you please help again?

Thanks,
Frank
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top