Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / July 2006

Tip: Looking for answers? Try searching our database.

DoCmd.OpenReport

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lewis M - 07 Jul 2006 22:44 GMT
I need to open a report based on two conditions. One condition is a user's
name, which is provided from a listbox on a form. The other condition is a
start date(sd) and end date(ed), which are provided from two calendar
controls on a form. I am trying to use the code below to open the report but
it doesn't work. Do you know how I can open a report using the conditions
stated?

sd = Form_Calendar.beg_date
ed = Form_Calendar.end_date

strLinkCriteria = "[BG_Responsible]=" & "'" & Me.List54.Value & "'"
strReportCriteria = "[HS_CHANGE_DATE] between #" & sd & "# and #" & ed & "#"
     
DoCmd.OpenReport stDocName, acViewPreview, strReportCriteria, strLinkCriteria
Ken Snell (MVP) - 07 Jul 2006 22:53 GMT
Combine the two criteria into a single clause:

sd = Form_Calendar.beg_date
ed = Form_Calendar.end_date

strLinkCriteria = "[BG_Responsible]='" & Me.List54.Value & "' And " & _
   "[HS_CHANGE_DATE] between #" & sd & "# and #" & ed & "#"

DoCmd.OpenReport stDocName, acViewPreview, , strLinkCriteria

Signature

       Ken Snell
<MS ACCESS MVP>

>I need to open a report based on two conditions. One condition is a user's
> name, which is provided from a listbox on a form. The other condition is a
[quoted text clipped - 13 lines]
> DoCmd.OpenReport stDocName, acViewPreview, strReportCriteria,
> strLinkCriteria
Lewis M - 10 Jul 2006 14:13 GMT
Ken, thanks. Your tip worked great.

> Combine the two criteria into a single clause:
>
[quoted text clipped - 23 lines]
> > DoCmd.OpenReport stDocName, acViewPreview, strReportCriteria,
> > strLinkCriteria
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.