Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Holding a Global Variable until I want it changed

Status
Not open for further replies.

Castanz

Programmer
Apr 5, 2002
61
US
I have a report with a signer's name at the bottom of the report. The signer changes about every 6 to 9 months. When the report is printed only the current signer should be listed on the report. My first idea is to set a Public variable equal to the signers name:
Code:
Public Global_Signer1 As String
then on load
Code:
Global_Signer1 = "John Smith"
but how do let an admin user alter the signer's name when needed without having the user edit the code? I don't want to prompt the user every time for the signer's name.

This seems like an easy problem, but I am baffled. Any help will be appreciated.
Thanks,
Castanz

 
1) Create a small table
2) Create a form to update the table
3) Setup the form so that only the Administrator can run the form.
4) In your mdb startup, just open the table and set the Global Global_Signer1 to the value in the table.

That's all folks....
Hap

Access Developer [pc] Access based Add-on Solutions
Access Consultants forum
 
Thanks, Hap
That got me going in the right direction. I used this code to retrieve from the tables:

Code:
Public Static Function Get_signer1(param)
'This function returns values from the table signers.
Dim VAR1 As String
If param = 1 Then
VAR1 = DLookup("[signer1]", "signers", "[ID] = 1")
Else
    If param = 2 Then
    VAR1 = DLookup("[signer2]", "signers", "[ID] = 1")
    Else
    MsgBox "Error calling parameter is not valid"
    End If
End If
Get_signer1 = VAR1
End Function

Then I put the function call
Code:
=Get_signer1(1)
in the control source for the text box.

Thanks again,
Al
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top