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.

Clear Public Variables Upon Query Run

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
brancazio95@gmail.com - 11 May 2006 23:08 GMT
I'm using public variables to store cumulative totals that are returned
to a query via a function.  For example, the query returns something
like this

Value     Total
1            1
2            3

A function is run on each line of data that adds the value from the
current record to the cumulative total in the public variable and
returns the new total from the public variable to the query.

I would like to reset the public variables when the query is run so
that they start from 0.  I have not found an easy way to do this.  The
only way I've figured out so far is to pass an autonumber to the
function, and when ID = 1, the function contains special logic that
resets the public variables.  This solution was fine when I only had
one group of related records in the query, but now I need to handle
multiple groups of related records.

Anyone have any ideas?
Douglas J. Steele - 12 May 2006 00:00 GMT
How are you invoking the query? Simply set the variables to 0 before you do
that.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

> I'm using public variables to store cumulative totals that are returned
> to a query via a function.  For example, the query returns something
[quoted text clipped - 17 lines]
>
> Anyone have any ideas?
 
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.