Help on Open Report Where Clause. Noob Here. (1 Viewer)

chayong91

New member
Local time
Today, 09:56
Joined
Aug 24, 2016
Messages
6
am just new in using ms access. i'm using ms access 2010. can you please help me fix this open report where clause?

whenever i run it separately like this:

DoCmd.OpenReport "rptDaily", acViewPreview, , "ReportDate = #" & txtDate.Value & "#"

DoCmd.OpenReport "rptDaily", acViewPreview, , "ReportTime Between #" & cmbHrsFrom.Value & "# And #" & cmbHrsTo.Value & "#"

this two run perfectly on it's own, but when i try to combine them by just adding "and" it's having "Run time error "13" type mismatch". i have also read some other solutions here but whenever i try something it also returns that message.

DoCmd.OpenReport "rptDaily", acViewPreview, , "ReportDate = #" & txtDate.Value & "#" And "ReportTime Between #" & cmbHrsFrom.Value & "# And #" & cmbHrsTo.Value & "#"

can you guys please help this noob. thank you! :)
 

Cronk

Registered User.
Local time
Today, 16:56
Joined
Jul 4, 2013
Messages
2,774
Delete the quotes marked in red.

DoCmd.OpenReport "rptDaily", acViewPreview, , "ReportDate = #" & txtDate.Value & "#" And "ReportTime Between #" & cmbHrsFrom.Value & "# And #" & cmbHrsTo.Value & "#"
 

chayong91

New member
Local time
Today, 09:56
Joined
Aug 24, 2016
Messages
6
holy! thank you very much! im actually having a hard time trying to understand those quotes and stuffs, maybe you got some site i can read to learn more about it?
 

Cronk

Registered User.
Local time
Today, 16:56
Joined
Jul 4, 2013
Messages
2,774
Maybe someone has sample sites. However, it's just standard debugging.

If you had put a break point on the line of code opening the report, then in the immediate window printed the where clause it would have been obvious.
 

chayong91

New member
Local time
Today, 09:56
Joined
Aug 24, 2016
Messages
6
and how can i do that? sorry am really just new in using access. ._.
 

chayong91

New member
Local time
Today, 09:56
Joined
Aug 24, 2016
Messages
6
anyway i think i'll been asking too many questions. thank you very much for your help. :)
 

Users who are viewing this thread

Top Bottom