DavidGeorge wrote:
I'm having trouble with what seems like a very simple function,
although it's the first I've used in Access so I could have it all
mixed up. It still works fine in forms I designed until yesterday,
but doesn't work in any new forms. Does anyone know what is going
wrong?
I have a module, "DoCSModule" which contains ...
(in the first two lines ...)
"Option Compare Database
Public CurrentProject As String"
( ... and further down ...)
"Public Function ProjKey() As String
ProjKey = DoCSModule.CurrentProject
End Function"
I call using the syntax, "ProjectKey = ProjKey()". In the most newly
designed forms it returns null, even though DoCSModule.CurrentProject
contains the information I need. As I mentioned, it still works fine
when called from the older forms. I wrote the (otherwise unnecessary)
function so that I could reference the Module variables from Queries.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Well, I don't know the solution to your problem (other than compact &
repair the DB - or recreate the form), but, I would suggest that you use
properties instead of functions (even though they act the same, sorta):
(in the first two lines ...)
Option Compare Database
Private m_CurrentProject As String"
( ... and further down ...)
Public Property Get ProjKey() As String
ProjKey = m_CurrentProject
End Property
Public Property Let ProjKey(strValue As String)
m_CurrentProject = strValue
End Property
You can change the Public/Private aspects of the property, depending on
if you want publicly Read-Only (Public get/Private let) or publicly Read
Write (Public get & let).
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQg5V2YechKqOuFEgEQJjZgCfSdPKQA1wu5DBDrrNAOid3A cLibwAn37S
izLra+VpZfE9mr1ZVoNGb80+
=Iymz
-----END PGP SIGNATURE-----