Version of MDE

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What is the best way to set a version number in my Front End .mde and then
retrieve that info and display it when the user opens the application?

I know I could create a table in the front end and put the version there and
display it on a form.

But, when I am ready to distribute my Front end, I use the Access Developer
Extensions Packaging Wizard. In step 6, I put in a version number. The help
instructions say this version number will be visible to anyone using
Add/Remove Programs function (which does not seem to be the case, by the
way). Is there any way to get the version number as specified in the
packaging wizard and display it on open?
 
Hi, Bill.
Is there any way to get the version number as specified in the
packaging wizard and display it on open?

Not unless you know where that version number is stored when installed on
the computer. But instead of worrying about that, why not try an easier way?
Create a user-defined Database Property for the database file and read it
whenever the form opens. For example, here's a function that will create a
new Database Property from the parameters sent to it:

Public Function setDBProp(sDBPropName As String, nType As Long, _
sValue As String) As Boolean

On Error GoTo ErrHandler

Dim prp As DAO.Property

Set prp = CurrentDb().CreateProperty(sDBPropName, nType, sValue)
CurrentDb().Properties.Append prp
setDBProp = True

CleanUp:

Set prp = Nothing

Exit Function

ErrHandler:

MsgBox "Error in setDBProp( )." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear
GoTo CleanUp

End Function

Call the setDBProp( ) function with this sub:

Public Sub setAppVersion()

On Error GoTo ErrHandler

Dim fSuccess As Boolean

fSuccess = setDBProp("AppVersion", dbText, "1.0")
MsgBox "Successfully set DB property: " & fSuccess

Exit Sub

ErrHandler:

MsgBox "Error in setAppVersion( )." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear

End Sub

Now, your form can read the Database Property in the form's OnOpen( ) event:

Private Sub Form_Open(Cancel As Integer)

Dim prp As DAO.Property

Set prp = CurrentDb().Properties("AppVersion")
Me!txtVersion.Value = prp.Value

CleanUp:

Set prp = Nothing

Exit Function

ErrHandler:

MsgBox "Error in Form_Open( )." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear
GoTo CleanUp

End Sub

.. . . where txtVersion is the name of the text box displaying the version
number.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.
 
Is there anything in your code that I should be concerned about with respect
to the fact the BE is on SQL Server. In other words, is the Property stored
in the FE or the BE?
 
Hi, Bill.

The property is assigned to CurrentDB( ), which is an Access Database Object
for the currently opened database file. Set this property in the front end
MDB file before making the MDE file out of it. This user-defined property
has no effect on any other database file, including the back end file, even
if the back end is Jet, SQL Server, Oracle, or some other DB engine, so you
needn't worry about any interference.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.
 
Back
Top