HillTJ
To train a dog, first know more than the dog..
- Local time
- Yesterday, 17:16
- Joined
- Apr 1, 2019
- Messages
- 731
Friends, I wish to increment a counter each time my main form is opened to track usage. I've Managed to save my usage counter & recall it to an unbound textbox using
I populate the 'usage' on the form thus, NewCounter = Usage()
Now I wish to increment it by 1 and resave the result.
I've tried to adapt the following Allen Browne code which i run from the on_load event of my form;
It doesn't work. Displays Run-Time error 91 'Object Variable or with block variable not set'
I don't understand the code nor the error message.
Please help.
Code:
Public Function Usage() ' recalls usage counter value from database properties
Dim DB As Database
Set DB = DBEngine(0)(0)
Usage = DB.Properties![UsageCounter]
End Function
I populate the 'usage' on the form thus, NewCounter = Usage()
Now I wish to increment it by 1 and resave the result.
I've tried to adapt the following Allen Browne code which i run from the on_load event of my form;
Code:
Function Update(filename As String)
Dim DB As dao.Database
DB.Properties![UsageCounter] = NewCounter + 1
DB.Close
End Function
It doesn't work. Displays Run-Time error 91 'Object Variable or with block variable not set'
I don't understand the code nor the error message.
Please help.