Can I use the 'Filter Property' to filter a group of addresses.

  • Thread starter Thread starter Frank Martin
  • Start date Start date
F

Frank Martin

I have Access2000.

On my 'FrmInvoice' there is a control button to access my 'RptAddresses'
which is based on 'QryAddresses'.

The 'QryAddresses' has all the appropriate columns on which to select the
type of customer and address.

My question is: is it possible to use the Filter Property to select a group
of addresses via the contol button code so as to save the trouble of using
yet another query?

For example, can I insert the following into the control button code: (to
apply to the RptAddesses".)
Me.Filter = "AddressType = 'Customer' "
Me.FilterOn = True ?

Please help, Frank
 
I have Access2000.

On my 'FrmInvoice' there is a control button to access my 'RptAddresses'
which is based on 'QryAddresses'.

The 'QryAddresses' has all the appropriate columns on which to select the
type of customer and address.

My question is: is it possible to use the Filter Property to select a group
of addresses via the contol button code so as to save the trouble of using
yet another query?

For example, can I insert the following into the control button code: (to
apply to the RptAddesses".)
Me.Filter = "AddressType = 'Customer' "
Me.FilterOn = True ?

Please help, Frank

Use the where clause argument of the OpenReport method to filter the
records.

DoCmd.OpenReport "rptAddresses",acViewPreview, ,"[AddressType] =
'Customer'"
 
For example, can I insert the following into the control button code: (to
apply to the RptAddesses".)
Me.Filter = "AddressType = 'Customer' "
Me.FilterOn = True ?

Yes.

John W. Vinson[MVP]
 
fredg said:
I have Access2000.

On my 'FrmInvoice' there is a control button to access my 'RptAddresses'
which is based on 'QryAddresses'.

The 'QryAddresses' has all the appropriate columns on which to select the
type of customer and address.

My question is: is it possible to use the Filter Property to select a group
of addresses via the contol button code so as to save the trouble of using
yet another query?

For example, can I insert the following into the control button code: (to
apply to the RptAddesses".)
Me.Filter = "AddressType = 'Customer' "
Me.FilterOn = True ?

Please help, Frank

Use the where clause argument of the OpenReport method to filter the
records.

DoCmd.OpenReport "rptAddresses",acViewPreview, ,"[AddressType] =
'Customer'"


Many thanks this worked:
I used "DoCmd.OpenReport "rptAddresses",acViewPreview, ,"[AddressType] =
'Customer'"" as you suggested.

But I wonder how more than one filter can be applied here; when I tried:

DoCmd.OpenReport "rptAddresses",acViewPreview, ,"[AddressType] =
'Customer'" and "[PeopleType] =
'Personal'"

it will not work.
 
fredg said:
I have Access2000.

On my 'FrmInvoice' there is a control button to access my 'RptAddresses'
which is based on 'QryAddresses'.

The 'QryAddresses' has all the appropriate columns on which to select the
type of customer and address.

My question is: is it possible to use the Filter Property to select a group
of addresses via the contol button code so as to save the trouble of using
yet another query?

For example, can I insert the following into the control button code: (to
apply to the RptAddesses".)
Me.Filter = "AddressType = 'Customer' "
Me.FilterOn = True ?

Please help, Frank

Use the where clause argument of the OpenReport method to filter the
records.

DoCmd.OpenReport "rptAddresses",acViewPreview, ,"[AddressType] =
'Customer'"

Many thanks this worked:
I used "DoCmd.OpenReport "rptAddresses",acViewPreview, ,"[AddressType] =
'Customer'"" as you suggested.

But I wonder how more than one filter can be applied here; when I tried:

DoCmd.OpenReport "rptAddresses",acViewPreview, ,"[AddressType] =
'Customer'" and "[PeopleType] =
'Personal'"

it will not work.

Because you are adding more criteria, you need to remove the end
double quote of the first criteria (after 'Customer'") so the
additional criteria is within the string. Then place it at the end of
the second criteria (='Personal'").

DoCmd.OpenReport "rptAddresses",acViewPreview, ,"[AddressType] =
'Customer' and [PeopleType] = 'Personal'"
 
Back
Top