Open Report with multiple where conditions

adamsro

New member
Local time
Yesterday, 21:33
Joined
Nov 26, 2024
Messages
4
Hello

I'm trying to open a report with 3 where conditions i can get the 1st to work but cannot seem to figure out how to get the second going. I assume once i get the second working the 3rd should be the same

This is the line that works with 1 condition
DoCmd.OpenReport "melreport", acViewReport, , "[Tag ID]='" & Me.Tag_ID & "'"

adding a second where condition? I get runtime error 13,
DoCmd.OpenReport "melreport", acViewReport, , "[Tag ID] ='" & Me.Tag_ID & "'" And "[Location]='" & Me.Location & "'"


Appreciate all the help
 
Welcome to Access World! We're so happy to have you join us as a member of our community. As the most active Microsoft Access discussion forum on the internet, with posts dating back more than 20 years, we have a wealth of knowledge and experience to share with you.

We're a friendly and helpful community, so don't hesitate to ask any questions you have or share your own experiences with Access. We're here to support you and help you get the most out of this powerful database program.

To get started, we recommend reading the post linked below. It contains important information for all new users of the forum:

https://www.access-programmers.co.uk/forums/threads/new-member-read-me-first.223250/

We hope you have a great time participating in the discussion and learning from other Access enthusiasts. We look forward to having you around!
 
Hi. Welcome to AWF!

Could you try?
Code:
DoCmd.OpenReport "melreport", acViewReport, , "[Tag ID] ='" & Me.Tag_ID & "' And [Location]='" & Me.Location & "'"
 
When i remove the " before location i now get a syntax error
 
Thanks for having me in the form i have done some VBA programming in the past but has been a long time since i touched it have some past experience with Access as well. Overall I'm probably a newb. Been getting buy with you tube videos and this forum so far
 
No need to remove anything. You should pastetheDBguys code. The difference is more than just one quote mark between yours and his.
 
Yes Sir thanks so much theDBguy had another look realized you removed 2 quotations it works now. Many thanks
 
Yes Sir thanks so much theDBguy had another look realized you removed 2 quotations it works now. Many thanks
You're welcome. Good luck with your project.
 

Users who are viewing this thread

Back
Top Bottom