hi Art,
yes. My contact template uses database properties. The latest version is here:
Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments
http://www.msaccessgurus.com/Contacts.htm
There are also a couple videos telling how to use it. The code has lots of comments.
use Set_Property to set the value of a property. For custom database properties, I start all the names with "local_" to make it easy to see my names. You could use anything -- just that it is best to use some kind of prefix.
use Get_Property to get the value of a property.
the code below has examples of how to call each in a comment.
respectfully,
crystal
~ have an awesome day ~
Please tell me you have an example of this at work... ? :)
With Warm Regards,Arthur D. LorenziniIT System ManagerCheyenne River Housing AuthorityWk.(605)964-4265 Ext. 130Fax (605)964-1070
"Valar Dohaeris"
On Tuesday, August 8, 2017 06:41:32 AM, crystal 8 strive4peace2008@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
hi Art,
Name and Version are reserved words and should not be used for names.
Problem names and reserved words in Access, Allen Browne
http://www.allenbrowne.com/AppIssueBadWord.html
To make it harder to find information, you could use database properties, which persist even when database is closed.
' set or change a database (or object) property
'~~~~~~~~~~~~~~~~~~~~~ Set_Property
Function Set_Property( _
psPropName As String _
, Optional pValue As Variant _
, Optional pDataType As Long = 0 _
, Optional Obj As Object _
, Optional bSkipMsg As Boolean = True _
) As Byte
's4p ... 130410, 160820, 170721
' PARAMETERS
' psPropName is the (database) property name to set
' optional:
' pValue is the value for the property
' pDataType is the Data Type: dbBoolean, dbLong, dbText, ...
' if not passed -- uses defaults
' bSkipMsg = True: don't give user feedback
' obj = database, field, tabledef, querydef,
' or other object with properties
' if obj is not specified, then CurrentDb is used
'
'EXAMPLE
' Call Set_Property("AppTitle", sAppTitle, dbText, db)
' where
' sAppTitle is defined -- or a literal value
'set up Error Handler
On Error GoTo Proc_Err
Dim booRelease As Boolean
booRelease = False
If Obj Is Nothing Then
Set Obj = CurrentDb
booRelease = True
End If
'assume property is defined
Obj.Properties(psPropName) = pValue
Proc_Done:
On Error Resume Next
If Not bSkipMsg Then
MsgBox psPropName & " is " _
& Obj.Properties(psPropName) _
& " for " & Obj.Name, , "Done"
End If
Proc_Exit:
On Error Resume Next
If booRelease = True Then
Set Obj = Nothing
End If
Exit Function
Proc_Err:
'property is not defined
Obj.Properties.Append Obj.CreateProperty( _
psPropName, pDataType, pValue)
Resume Proc_Done
Resume
End Function
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'
' get the value of a database (or object) property
' pass (optional) object to look somewhere other than CurrentDb
' pass (optional) default value
'~~~~~~~~~~~~~~~~~~~~~ Get_Property
Function Get_Property( _
psPropName As String _
, Optional Obj As Object _
, Optional pvDefaultValue As Variant _
) As Variant
's4p 8-9 ... 130831, 160820, 170721
' PARAMETERS
' REQUIRED
' psPropName is the (database) property name to return the value of
' OPTIONAL
' obj = database, field, tabledef, querydef,
' or other object with properties collection
' if obj is not specified, then CurrentDb is used
' pvDefaultValue is value to return if property cannot be read
'
'RETURNS
' Null (or pvDefaultValue) if property has no value or is not defined
' OR
' Value of property
'EXAMPLE
' MyValue = Get_Property("MyDatabasePropertyName")
On Error GoTo Proc_Err
Dim booRelease As Boolean
booRelease = False
'initialize return value
If Not IsNull(pvDefaultValue) Then
Get_Property = pvDefaultValue
Else
Get_Property = Null
End If
On Error GoTo Proc_Exit
If Obj Is Nothing Then
Set Obj = CurrentDb
booRelease = True
End If
Get_Property = Obj.Properties(psPropName)
Proc_Exit:
On Error Resume Next
If booRelease = True Then
Set Obj = Nothing
End If
Exit Function
Proc_Err:
' MsgBox Err.Description, , _
"ERROR " & Err.Number _
& " Get_Property: Property not defined"
Resume Proc_Exit
Resume
End Function
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
respectfully,
crystal
~ have an awesome day ~
On 8/7/17 8:37 PM, John Viescas JohnV@msn.com [MS_Access_Professionals] wrote:
Art-
In the Load event of the startup form, open the table and look at InstallDate. If it's empty, put Date() in it and then let the app run. If it has a value, test to see if is more than n days ago. If it is, use MsgBox to tell the user that the trial period has ended and then do Application.Quit.
If the user wants to bother, he can set his system date back temporarily to run the app.
John Viescas, AuthorEffective SQLSQL Queries for Mere MortalsMicrosoft Access 2010 Inside OutMicrosoft Access 2007 Inside OutMicrosoft Access 2003 Inside OutBuilding Microsoft Access Applications(Paris, France)
On Aug 7, 2017, at 7:49 PM, Art Lorenzini dbalorenzini@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
John,I created a table called tblversion:Columns
Name Type Size
Version Currency 8
VersionDate Date With Time 8
InstallDate Date With Time 8
InstallDateCount Long Integer 4
OpenCount Long Integer 4
InstallationTypeID Long Integer 4
InstallSubTypeID Long Integer 4
BuildNumber Short Text 255
BuildDate Short Text 255
DBAllowed Long Integer 4
GroupsAllowedID Long Integer 4
DocumentLimit Long Integer 4
InternalMachineID Short Text 255
I have Install date and install date count, what would the next step be?
With Warm Regards,Arthur D. LorenziniIT System ManagerCheyenne River Housing AuthorityWk.(605)964-4265 Ext. 130Fax (605)964-1070
"Valar Dohaeris"
On Monday, August 7, 2017 11:02:16 AM, John Viescas JohnV@msn.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
Art-
One technique is to put a "first used" date/time field in a hidden table. When your trial version starts up, check that field, and if it's Null, then set it to today's date. If it's not Null, then see if today is more than 60 days past the "first used" date, and if so, don't allow the application to start.
John Viescas, authorEffective SQLSQL Queries for Mere MortalsMicrosoft Office Access 2010 Inside OutMicrosoft Office Access 2007 Inside OutBuilding Access Applications
On Aug 7, 2017, at 07:46, dbalorenzini@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
Posted by: crystal 8 <strive4peace2008@yahoo.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (7) |
Tidak ada komentar:
Posting Komentar