VBA strCriteria

A

Andy

Hi;

Instead of creating 2 seperate querries w/2 seperate criteria; want to use
strCriteria in the OnClick event to filter the reports.

One strCriteria is "UnitsOnOrder>0" and the other is "UnitsInStock>0"

Have tried this and it doesn't work:

Placed a cmdbutton in the form.
It's OnClickEvent is:

Dim strCriteria As String
strCriteria = [UnitsInStock] >0
DoCmd.OpenReport "rptInventory", acPreview, , strCriteria

Would someone be so kind to point me in the right direction,

Thank You.

Andy
 
F

fredg

Hi;

Instead of creating 2 seperate querries w/2 seperate criteria; want to use
strCriteria in the OnClick event to filter the reports.

One strCriteria is "UnitsOnOrder>0" and the other is "UnitsInStock>0"

Have tried this and it doesn't work:

Placed a cmdbutton in the form.
It's OnClickEvent is:

Dim strCriteria As String
strCriteria = [UnitsInStock] >0
DoCmd.OpenReport "rptInventory", acPreview, , strCriteria

Would someone be so kind to point me in the right direction,

Thank You.

Andy

The where clause must be a string.

strCriteria = "[UnitsInStock] > 0"
 
M

Marshall Barton

Andy said:
Instead of creating 2 seperate querries w/2 seperate criteria; want to use
strCriteria in the OnClick event to filter the reports.

One strCriteria is "UnitsOnOrder>0" and the other is "UnitsInStock>0"

Have tried this and it doesn't work:

Placed a cmdbutton in the form.
It's OnClickEvent is:

Dim strCriteria As String
strCriteria = [UnitsInStock] >0
DoCmd.OpenReport "rptInventory", acPreview, , strCriteria



THe WhereCondition argument is a string so you need to useL

strCriteria = "[UnitsInStock] >0"
 

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