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

Stuart McLachlan stuart at lexacorp.com.pg
Thu Jan 13 16:59:18 CST 2011


Simple solution - don't use a Global Constant!

Use a system lookup table to store the VersionID and  a STATIC function  in your reports etc.

Function SetVersionID() 
Dim strSQL as string
StrSQL = "Update tblSysfile Set VersionID ='" & _
   Format(Now(),"ddd.d/mm/yyyy at hh:mm")
Currentdb.Execute strSQL
End Function

Static Function VersionID() as String
Dim store as string
If len(store) = "" then
    Store = DLookup("VersionID","tblSysfile")
End if
VersionID = store
End Function



On 13 Jan 2011 at 16:40, Brad Marks wrote:

> 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.)
> 
..
> 
> 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"
> 




More information about the AccessD mailing list