openreport where

M

mark r

Three (3) questions:
The Where condition argument is a string.
If xdate and datefilter are in short date format mm/dd/yyyy
1. is this statement below correct?
DoCmd.OpenReport stDame, acPreview, , "[xdate] =" &
[Forms]![test]![datefilter]

2. should I be using parens () instead of brackets []
around
xdate?

Below, xxxxfilter is a string, then you have to delimit
with quotes:
DoCmd.OpenReport stDame, acPreview, , "[pushupp] = '" &
[Forms]![test]![xxxxfilter] & "'"

3.what situations would xxxxfilter be a string?
 
F

fredg

Three (3) questions:
The Where condition argument is a string.
If xdate and datefilter are in short date format mm/dd/yyyy
1. is this statement below correct?
DoCmd.OpenReport stDame, acPreview, , "[xdate] =" &
[Forms]![test]![datefilter]

If [xdate] is a DateTime datatype...

DoCmd.OpenReport stDame, acPreview, , "[xdate] = #" &
[Forms]![test]![datefilter] & "#"
2. should I be using parens () instead of brackets []
around
xdate?

Use brackets around field and control names.
Below, xxxxfilter is a string, then you have to delimit
with quotes:
DoCmd.OpenReport stDame, acPreview, , "[pushupp] = '" &
[Forms]![test]![xxxxfilter] & "'"

3.what situations would xxxxfilter be a string?

It depends upon the datatype of [pushupp].
If it is a string, then your above syntax is OK.

If it is a date datatype, then my first example above, with the
criteria wrapped within the # characters is correct.

If it is a number datatype, then:
"[pushupp] = " & [Forms]![test]![xxxxfilter]
 
M

mark r

I find that if I use [] ACCESS says it can't find the |
in my expression...........if I use parens I have no
problem

any comments?

ACCESS 2000








-----Original Message-----
Three (3) questions:
The Where condition argument is a string.
If xdate and datefilter are in short date format mm/dd/yyyy
1. is this statement below correct?
DoCmd.OpenReport stDame, acPreview, , "[xdate] =" &
[Forms]![test]![datefilter]

If [xdate] is a DateTime datatype...

DoCmd.OpenReport stDame, acPreview, , "[xdate] = #" &
[Forms]![test]![datefilter] & "#"
2. should I be using parens () instead of brackets []
around
xdate?

Use brackets around field and control names.
Below, xxxxfilter is a string, then you have to delimit
with quotes:
DoCmd.OpenReport stDame, acPreview, , "[pushupp] = '"
&
[Forms]![test]![xxxxfilter] & "'"

3.what situations would xxxxfilter be a string?

It depends upon the datatype of [pushupp].
If it is a string, then your above syntax is OK.

If it is a date datatype, then my first example above, with the
criteria wrapped within the # characters is correct.

If it is a number datatype, then:
"[pushupp] = " & [Forms]![test]![xxxxfilter]

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
.
 

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