[AccessD] Is it possible to update VBA code with VBA?

Dan Waters df.waters at comcast.net
Thu Jan 13 16:53:22 CST 2011


This is what I do:

Have a hidden form named frmLatestUpdate.  Set your AutoExec or Startup Form
to open this form.  When the form closes, run the Form_Close event to change
a date field in the tabled named tblLatestUpdate.  The key here is that this
code can only run when the application is opened by the developer or on the
developer's PC so that no one else changes this date.  

But if your developer is also a regular user of the app, this won't work.
You might have a question MsgBox appear when the developer closes the
database asking him/her if they want to update the Latest Update field.

Now, your reports can include this date/time in the report footer.

Note - I use this primarily so that a client app will be automatically
updated from the server when a user logs in.

Dan

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Brad Marks
Sent: Thursday, January 13, 2011 4:41 PM
To: Access Developers discussion and problem solving
Subject: [AccessD] Is it possible to update VBA code with VBA?

All,

We have an Access application that creates a number of reports and is
used by several people.  In addition, because the application is fairly
new, it is being enhanced on a regular basis.

In order to avoid confusion, we have decided to establish a simple
"Application Version ID" that is shown at the bottom of all reports (and
also on forms).  The format of this Version ID is
Day.Month/Day/Year at Hour:Minute (example Thu.1/13/2011 at 15:53).  This
works nicely when we want to see which version of the application was
used to generate a previously generated report, etc.

Currently, we have a simple routine which generates our Version ID.
When changes are made to the application by our programmer, this routine
is used to generate a new Version ID and display it in a TextBox.  We
then manually copy this generated ID into the value of a Global Constant
field which is referenced in several places in the application.  (Note
that only the Access programmer is allowed to change the application.)


This process works Okay, but it would be better if we could
programmatically update the value of the constant field when the
application is changed by the programmer.  

Is there a way to update VBA code with VBA?  In other words, can a VBA
routine update other VBA code? (A small routine to generate our Version
ID and then plug the generated ID into the value of a Global constant).

Here is our Global Constant Field with its value. 
Global Const Con_Version_ID As String = "Thu.1/13/2011 at 15:53"

This might be a really dumb question.  We just have never tried to do
this before.

Thanks for your help.
Brad

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list