Full Version: How to address a form from a module?
UtterAccess Forums > Microsoft® Access > Access Forms
Blacksmith
I try to upadate a value on a form from the code of a module. This will work fine:
!--c1-->
CODE
Forms!Main!LastAutobackup = gTimeOfLastBackup

However, I do need to repalce 'Main' by a constant. What is the syntax for this?
CODE
Private Const cNameOfMainForm = "Main"
...
Forms!?????????????!LastAutobackup = gTimeOfLastBackup

Oalways have difficulties with this. Is there a a good place to learn about? I do know http://www.mvps.org/access/forms/frm0031.htm - but I think this will not help here, as my code is in a module and not on a form.
Roger_Carlson
Try this:
orms(cNameOfMainForm)!LastAutobackup = gTimeOfLastBackup
For this
Forms(cNameOfMainForm)("LastAutobackup") = gTimeOfLastBackup
EDIT:
THere are some references:
http://msdn.microsoft.com/en-us/library/aa...office.11).aspx
http://msdn.microsoft.com/en-us/library/aa...office.11).aspx
Blacksmith
Thank you!
!--c1-->
CODE
Forms(cNameOfMainForm)!LastAutobackup = gTimeOfLastBackup
works fine!
I was quite close - tried:
CODE
Forms!(cNameOfMainForm)!LastAutobackup = gTimeOfLastBackup
Near miss is still a miss!
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.