(first time post so hopefully I am explaining it clearly)
Hi I am getting two different values for the same user defined property while using the with statement in two different procedures
I expect that since its all in the same database, no matter where I call currentdb.properties!ProgState, after it is created, it would return the same value.
How can I make it do that? Thanks in advance.
Situation:
In a non-class module I have:
Code:
Public gFuncResult
Public gdaoDB As DAO.Database
Public gdaoPR As DAO.Properties
In a Form Module I have this:
Code:
Private Sub Form_Open(Cancel As Integer)
Call Test3
End Sub
Private Sub Test3()
Set gdaoDB = CurrentDb
Set gdaoPR = gdaoDB.Properties
With gdaoPR
Debug.Print "1:" & !ProgState
gFuncResult = ShowThesePropVals()
Debug.Print "3:" & !ProgState
End With
End Sub
In a non-class module I have
Code:
Public Function ShowThesePropVals()
Set gdaoDB = CurrentDb
Set gdaoPR = gdaoDB.Properties
With gdaoPR
Debug.Print "2:" & !ProgState
Debug.Print "2a:" & CurrentDb.Properties!ProgState
CurrentDb.Properties!ProgState = "X"
Debug.Print "2c:" & !ProgState
Debug.Print "2d:" & CurrentDb.Properties!ProgState
End With
ShowThesePropVals = True 'for now, will change this later
End Function
I have stripped code and rerun exactly as above and still have a problem. When I open the form this is what I get in the debug window:
1:r
2:r
2a:r
2c:r
2d:X
3:r
I would expect 2c to be "X" as well as 3.
I want everything after the value change to reflect the change, why don't they and how can I be sure the changes are made to the property (is the 'with' statement not recomended?)
Thanks in advance