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 / Modules / DAO / VBA / May 2006

Tip: Looking for answers? Try searching our database.

Sending Peramiter Values to a Variable

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jurrasicway - 23 May 2006 15:29 GMT
Hi,
I have a report that is based on a query. The query is filled with
information between two dates that are set as peramiters in the query. [Start
Date] and [End Date]. How do I pass the values of the peramiters to my
variables to undertake a calculation to show how many days there are between
the dates. My code is as follows and in the OnActivate event of my report:

Private Sub Report_Activate()
Dim StartDate As Integer
Dim EndDate As Integer
Dim Days As Integer
Dim query As Control
StartDate = [Start Date]        '[Start Date] and [End Date] are peramiters
EndDate = [End Date]            'that are taken from a query to produce the
report
Days = EndDate - StartDate
Me.txtDays = Days               'txtDays is the control I wish to pass the
calculation to
End Sub
Marshall Barton - 23 May 2006 19:38 GMT
>I have a report that is based on a query. The query is filled with
>information between two dates that are set as peramiters in the query. [Start
[quoted text clipped - 14 lines]
>calculation to
>End Sub

That code looks like it would work, but only if you have a
text box that refers to the parameters.  However, since you
seem to want to put the calculations in a text box anyway,
there is no need to use any code to do it.  Just set a text
box's expression to something like:
    =DateDiff("d", [Start Date], [End Date])

Signature

Marsh
MVP [MS Access]

 
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.