Where condition

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to open a report
and I want to do a where condition
for two things. I want it to go to the vendor number and month.
Can anyone help me on how to do this. I am able to one with the wizard, but
not on my own with a code.

My report is called resubmitt
query is Resubmit
and i have vendor number in both my form and query along with month field.
Thanks
 
I would like to open a report
and I want to do a where condition
for two things. I want it to go to the vendor number and month.
Can anyone help me on how to do this. I am able to one with the wizard, but
not on my own with a code.

My report is called resubmitt
query is Resubmit
and i have vendor number in both my form and query along with month field.
Thanks

In VBA Help look up:
OpenReport method.
Notice that the 4th argument is the Where clause.
DoCmd.OpenReport "ReportName", acViewPreview, , "[Vendor Number] = " ?
& " and [Month] = " & ?

Unfortunately, you did not mention what the datatypes were of [Vendor
Number] and [Month] so the above is just a generalized idea of how to
concatenate the form data into the clause.
The actual syntax depends upon whether the criteria field is a Number,
Text, or Date datatype.

Also look up in VBA help:
Restrict Data to a subset of records
To learn how to complete the above OpenReport where clause for the
various datatypes.
 
When I use the code just given is says syntax error, missing operator in query.

fredg said:
I would like to open a report
and I want to do a where condition
for two things. I want it to go to the vendor number and month.
Can anyone help me on how to do this. I am able to one with the wizard, but
not on my own with a code.

My report is called resubmitt
query is Resubmit
and i have vendor number in both my form and query along with month field.
Thanks

In VBA Help look up:
OpenReport method.
Notice that the 4th argument is the Where clause.
DoCmd.OpenReport "ReportName", acViewPreview, , "[Vendor Number] = " ?
& " and [Month] = " & ?

Unfortunately, you did not mention what the datatypes were of [Vendor
Number] and [Month] so the above is just a generalized idea of how to
concatenate the form data into the clause.
The actual syntax depends upon whether the criteria field is a Number,
Text, or Date datatype.

Also look up in VBA help:
Restrict Data to a subset of records
To learn how to complete the above OpenReport where clause for the
various datatypes.
 
I still can not get it to work properly. Vendor Number is a text and so is
month

DoCmd.OpenReport "Denial", acViewPreview, ,"[Denial]![Vendor
Number]=[Forms]![New CCG Status-October]![Text79]" & "[Denial]![Vendor
Number]=[Forms]![New CCG Status-October]![Text15]"

Can you help?


fredg said:
I would like to open a report
and I want to do a where condition
for two things. I want it to go to the vendor number and month.
Can anyone help me on how to do this. I am able to one with the wizard, but
not on my own with a code.

My report is called resubmitt
query is Resubmit
and i have vendor number in both my form and query along with month field.
Thanks

In VBA Help look up:
OpenReport method.
Notice that the 4th argument is the Where clause.
DoCmd.OpenReport "ReportName", acViewPreview, , "[Vendor Number] = " ?
& " and [Month] = " & ?

Unfortunately, you did not mention what the datatypes were of [Vendor
Number] and [Month] so the above is just a generalized idea of how to
concatenate the form data into the clause.
The actual syntax depends upon whether the criteria field is a Number,
Text, or Date datatype.

Also look up in VBA help:
Restrict Data to a subset of records
To learn how to complete the above OpenReport where clause for the
various datatypes.
 
I still can not get it to work properly. Vendor Number is a text and so is
month

DoCmd.OpenReport "Denial", acViewPreview, ,"[Denial]![Vendor
Number]=[Forms]![New CCG Status-October]![Text79]" & "[Denial]![Vendor
Number]=[Forms]![New CCG Status-October]![Text15]"

Can you help?

fredg said:
I would like to open a report
and I want to do a where condition
for two things. I want it to go to the vendor number and month.
Can anyone help me on how to do this. I am able to one with the wizard, but
not on my own with a code.

My report is called resubmitt
query is Resubmit
and i have vendor number in both my form and query along with month field.
Thanks

In VBA Help look up:
OpenReport method.
Notice that the 4th argument is the Where clause.
DoCmd.OpenReport "ReportName", acViewPreview, , "[Vendor Number] = " ?
& " and [Month] = " & ?

Unfortunately, you did not mention what the datatypes were of [Vendor
Number] and [Month] so the above is just a generalized idea of how to
concatenate the form data into the clause.
The actual syntax depends upon whether the criteria field is a Number,
Text, or Date datatype.

Also look up in VBA help:
Restrict Data to a subset of records
To learn how to complete the above OpenReport where clause for the
various datatypes.

Didn't you look up the "Restrict data to a subset of records" as I had
suggested? There are examples of the correct syntax for Text datatypes
as well as multiple criteria.

DoCmd.OpenReport "Denial", acViewPreview, ,"[Vendor Number] = '" &
[Forms]![New CCG Status-October]![Text79] & " AND [Month]= '" &
[Forms]![New CCG Status-October]![Text15] & "'"

If you have fields by the Month name and forms that include the month
name in it's title I would speculate that your database is not
normalized.
 
hello again.
Since it keeps telling me Missing operator in query then reads out what I am
looking for. Can I filter by month then look for the vendor number? If so, I
am not quiet sure the order to do that either.
Please Help!!!!!

fredg said:
I still can not get it to work properly. Vendor Number is a text and so is
month

DoCmd.OpenReport "Denial", acViewPreview, ,"[Denial]![Vendor
Number]=[Forms]![New CCG Status-October]![Text79]" & "[Denial]![Vendor
Number]=[Forms]![New CCG Status-October]![Text15]"

Can you help?

fredg said:
On Mon, 6 Feb 2006 16:59:31 -0800, Chey wrote:

I would like to open a report
and I want to do a where condition
for two things. I want it to go to the vendor number and month.
Can anyone help me on how to do this. I am able to one with the wizard, but
not on my own with a code.

My report is called resubmitt
query is Resubmit
and i have vendor number in both my form and query along with month field.
Thanks

In VBA Help look up:
OpenReport method.
Notice that the 4th argument is the Where clause.
DoCmd.OpenReport "ReportName", acViewPreview, , "[Vendor Number] = " ?
& " and [Month] = " & ?

Unfortunately, you did not mention what the datatypes were of [Vendor
Number] and [Month] so the above is just a generalized idea of how to
concatenate the form data into the clause.
The actual syntax depends upon whether the criteria field is a Number,
Text, or Date datatype.

Also look up in VBA help:
Restrict Data to a subset of records
To learn how to complete the above OpenReport where clause for the
various datatypes.

Didn't you look up the "Restrict data to a subset of records" as I had
suggested? There are examples of the correct syntax for Text datatypes
as well as multiple criteria.

DoCmd.OpenReport "Denial", acViewPreview, ,"[Vendor Number] = '" &
[Forms]![New CCG Status-October]![Text79] & " AND [Month]= '" &
[Forms]![New CCG Status-October]![Text15] & "'"

If you have fields by the Month name and forms that include the month
name in it's title I would speculate that your database is not
normalized.
 
hello again.
Since it keeps telling me Missing operator in query then reads out what I am
looking for. Can I filter by month then look for the vendor number? If so, I
am not quiet sure the order to do that either.
Please Help!!!!!

fredg said:
I still can not get it to work properly. Vendor Number is a text and so is
month

DoCmd.OpenReport "Denial", acViewPreview, ,"[Denial]![Vendor
Number]=[Forms]![New CCG Status-October]![Text79]" & "[Denial]![Vendor
Number]=[Forms]![New CCG Status-October]![Text15]"

Can you help?

:

On Mon, 6 Feb 2006 16:59:31 -0800, Chey wrote:

I would like to open a report
and I want to do a where condition
for two things. I want it to go to the vendor number and month.
Can anyone help me on how to do this. I am able to one with the wizard, but
not on my own with a code.

My report is called resubmitt
query is Resubmit
and i have vendor number in both my form and query along with month field.
Thanks

In VBA Help look up:
OpenReport method.
Notice that the 4th argument is the Where clause.
DoCmd.OpenReport "ReportName", acViewPreview, , "[Vendor Number] = " ?
& " and [Month] = " & ?

Unfortunately, you did not mention what the datatypes were of [Vendor
Number] and [Month] so the above is just a generalized idea of how to
concatenate the form data into the clause.
The actual syntax depends upon whether the criteria field is a Number,
Text, or Date datatype.

Also look up in VBA help:
Restrict Data to a subset of records
To learn how to complete the above OpenReport where clause for the
various datatypes.

Didn't you look up the "Restrict data to a subset of records" as I had
suggested? There are examples of the correct syntax for Text datatypes
as well as multiple criteria.

DoCmd.OpenReport "Denial", acViewPreview, ,"[Vendor Number] = '" &
[Forms]![New CCG Status-October]![Text79] & " AND [Month]= '" &
[Forms]![New CCG Status-October]![Text15] & "'"

If you have fields by the Month name and forms that include the month
name in it's title I would speculate that your database is not
normalized.

Sorry. I left out a single quote.
Where I wrote
..... [Text79] & " AND [Month] ...
it should have been:
..... [Text79] & " ' AND [Month] ... (without the space between the
single and double quote).

Try it like this:

DoCmd.OpenReport "Denial", acViewPreview, ,"[Vendor Number] = '" &
[Forms]![New CCG Status-October]![Text79] & "' AND [Month]= '" &
[Forms]![New CCG Status-October]![Text15] & "'"
 
Back
Top