this code could try to set a value if the property already exists, and only create it if necessary.
then, to get a property that has been set:
Code:
myvariable = CurrentDb.Properties(sPropName)
to clear a text database property, set it to " " as it cannot hold a zero-length string -- then test for this. To clear numeric properties, I normally set them to -99 and test for < 0
You can also use TempVars (although they are not as stable or persistent)
using VBA to add or change a tempvar:
Code:
TempVars.Add "tvVariableName", valueOrVariablename
if the tempvar already has a value, it will be changed
you can retrieve the value like this:
Code:
TempVars!tvVariableName
-- as ControlSource... =[TempVars]![tvVariableName]
-- in query... [TempVars]![tvVariableName]
-- in code, you can also use TempVars("tvVariableName")
Warm Regards,
Crystal
Microsoft MVP, Access
Remote Programming and Training
http://msaccessgurus.com/
303-335-0727
free video tutorials (Access, Excel, Windows Phone, Windows 8)
http://www.youtube.com/LearnAccessByCrystal
,
http://www.youtube.com/LearnByCrystal
Access Basics
http://www.accessmvp.com/strive4peace
free 100-page book that covers essentials in Access
*
have an awesome day
*