Connecting Tech Pros Worldwide Help | Site Map

Popup Form Report Filter

Nathan Bloomfield
Guest
 
Posts: n/a
#1: Nov 12 '05
"[MyDate] Between #" & Format(Me![BeginDate], "mm/dd/yy") & "# and #"
& Format(Me![EndDate], "mm/dd/yy") & "# AND [DC] = "'" & Me![DCselect]
& "'"

When running the code above I get the following error:

"Microsoft Access can't find the field "|" referred to in your
expression

The code works fine when just using the "date" filter, but falls apart
when the "DC" filter is included.

Can anyone offer any suggestions as to how to correct the error or
alternatives to the code above?

Regards,

Nathan

BTW I have reposted this code which is related to another thread as I
require urgent assistance. This problem is holding back a project
which must be completed in 2 days time.
Nathan Bloomfield
Guest
 
Posts: n/a
#2: Nov 12 '05

re: Popup Form Report Filter


I would really appreciate any help on this one.

The following code works perfectly:

DoCmd.OpenReport "rptthruputdaily", acViewPreview, , "[MyDate] Between
#" & Format(Me![BeginDate], "mm/dd/yy") & "# and #" &
Format(Me![EndDate], "mm/dd/yy") & "#"

The following does not:

DoCmd.OpenReport "rptthruputdaily", acViewPreview, , "[DC] =
Me![DCSelect]"

I get a prompt asking for the value of me!DCSelect

Even if I change the fields to [Mydate] = Me![BeginDate] (which works
above) the fields are not recognised.

Do I need to specify the format (which is text) in order for the
system to recognise the field?


Thanks.
Nathan Bloomfield
Guest
 
Posts: n/a
#3: Nov 12 '05

re: Popup Form Report Filter


I have come up with a solution:

DoCmd.OpenReport "rptthruputdaily", acViewPreview, , "[MyDate]
Between #" & Format(Me![BeginDate], "mm/dd/yy") & "# and #" &
Format(Me![EndDate], "mm/dd/yy") & "#"
If Me![DCSelect] <> "" Then
Reports!rptthruputdaily.Filter = "[DC] = '" & Me![DCSelect] & "'"
Reports!rptthruputdaily.FilterOn = True

But I still welcome any suggestions which may be more efficiant.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Closed Thread


Similar Microsoft Access / VBA bytes