where clause

M

mark r

here's the code
my report comes up with no data with this code if I
populate idfilter. if i leave it blank, all the records
come up.
there is nothing wrong with the form. the fieldname, the
form name are correct.

private Sub bvd_Click()
On Error GoTo Err_test_Click


Dim stDame As String

stDame = "bvd"
DoCmd.OpenReport stDame, acPreview, testbvd, ,
acWindowNormal
DoCmd.OpenReport stDame, acPreview, , pushupp =
[Forms]![test]![idfilter], acWindowNormal

' DoCmd.OpenReport stDame, acPreview, , (pushupp)
= "cam"

' DoCmd.OpenReport stDame, acPreview, , (((pushupp) =
[Forms]![test]![idfilter]))
'DoCmd.OpenReport stDame, acPreview, , (((bvd.pushupp)
= Forms]![test]![idfilter]))
'WHERE (((BVD.pushupp)=[forms]![test]![idfilter]));

Exit_bvd:
Exit Sub

Err_test_Click:
MsgBox Err.description
Resume Exit_bvd

End Sub
 
D

Dan Artuso

Hi,
The Where condition argument is a string, so...

DoCmd.OpenReport stDame, acPreview, , "[pushupp] =" & [Forms]![test]![idfilter]

If idfilter is a string, then you have to delimit with quotes:

DoCmd.OpenReport stDame, acPreview, , "[pushupp] = '" & [Forms]![test]![idfilter] & "'"
 
M

Mark R

would it be any different if I were using:
xdate instead of pushupp, where xdate is in short date
format mm/dd/yyyy

would[Forms]![test]![datefilter] be written any
differently? with a Format statement? or delimited? etc?

should I be using parens ( instead of brackets [ around
the name to the left of the equal sign?
-----Original Message-----
Hi,
The Where condition argument is a string, so...

DoCmd.OpenReport stDame, acPreview, , "[pushupp] =" & [Forms]![test]![idfilter]

If idfilter is a string, then you have to delimit with quotes:

DoCmd.OpenReport stDame, acPreview, , "[pushupp] = '" &
[Forms]![test]![idfilter] & "'"
--
HTH
Dan Artuso, Access MVP


"mark r" <[email protected]> wrote in
message news:[email protected]...
here's the code
my report comes up with no data with this code if I
populate idfilter. if i leave it blank, all the records
come up.
there is nothing wrong with the form. the fieldname, the
form name are correct.

private Sub bvd_Click()
On Error GoTo Err_test_Click


Dim stDame As String

stDame = "bvd"
DoCmd.OpenReport stDame, acPreview, testbvd, ,
acWindowNormal
DoCmd.OpenReport stDame, acPreview, , pushupp =
[Forms]![test]![idfilter], acWindowNormal

' DoCmd.OpenReport stDame, acPreview, , (pushupp)
= "cam"

' DoCmd.OpenReport stDame, acPreview, , (((pushupp) =
[Forms]![test]![idfilter]))
'DoCmd.OpenReport stDame, acPreview, , (((bvd.pushupp)
= Forms]![test]![idfilter]))
'WHERE (((BVD.pushupp)=[forms]![test]![idfilter]));

Exit_bvd:
Exit Sub

Err_test_Click:
MsgBox Err.description
Resume Exit_bvd

End Sub


.
 
D

Dan Artuso

Hi,
Yes, for dates you need to delimit with #

--
HTH
Dan Artuso, Access MVP


Mark R said:
would it be any different if I were using:
xdate instead of pushupp, where xdate is in short date
format mm/dd/yyyy

would[Forms]![test]![datefilter] be written any
differently? with a Format statement? or delimited? etc?

should I be using parens ( instead of brackets [ around
the name to the left of the equal sign?
-----Original Message-----
Hi,
The Where condition argument is a string, so...

DoCmd.OpenReport stDame, acPreview, , "[pushupp] =" & [Forms]![test]![idfilter]

If idfilter is a string, then you have to delimit with quotes:

DoCmd.OpenReport stDame, acPreview, , "[pushupp] = '" &
[Forms]![test]![idfilter] & "'"
--
HTH
Dan Artuso, Access MVP


"mark r" <[email protected]> wrote in
message news:[email protected]...
here's the code
my report comes up with no data with this code if I
populate idfilter. if i leave it blank, all the records
come up.
there is nothing wrong with the form. the fieldname, the
form name are correct.

private Sub bvd_Click()
On Error GoTo Err_test_Click


Dim stDame As String

stDame = "bvd"
DoCmd.OpenReport stDame, acPreview, testbvd, ,
acWindowNormal
DoCmd.OpenReport stDame, acPreview, , pushupp =
[Forms]![test]![idfilter], acWindowNormal

' DoCmd.OpenReport stDame, acPreview, , (pushupp)
= "cam"

' DoCmd.OpenReport stDame, acPreview, , (((pushupp) =
[Forms]![test]![idfilter]))
'DoCmd.OpenReport stDame, acPreview, , (((bvd.pushupp)
= Forms]![test]![idfilter]))
'WHERE (((BVD.pushupp)=[forms]![test]![idfilter]));

Exit_bvd:
Exit Sub

Err_test_Click:
MsgBox Err.description
Resume Exit_bvd

End Sub


.
 

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

Similar Threads


Top