Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Morecambe England, Lancashire, England
    Posts
    105
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Global Variables (Windows 98/Office 2000)

    I have a number of reports in a charitable giving database I have made, that all have a footer that will say something like "Morecambe Parish Church". No problem there it works fine!

    The problem is that this database is becoming increasingly popular with other churches, so every time I give them a copy (note the word give!), it means that I have go through every report and change the bottom line so that it give the name of that particular church.

    Is it possible in VBA to simply declare a variable that every report can see so that all I have to put on the bottom of the report is something like [Name_Of_Church]

    Thanks for your help
    Michael Peak
    Morecambe, England

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Global Variables (Windows 98/Office 2000)

    What you could do is create a table tblSettings with custom settings:

    <table border=1><td align=center>Option</td><td align=center>Setting</td><td>Church</td><td>Morecambe Parish Church</td><td>Reverend</td><td>Donald Jones</td><td>...</td><td>...</td></table>
    Instead of a label in the report footer, use a text box with Control Source

    <code>=DLookup("Setting","tblSettings","Option='Ch urch'")</code>

    You only need to change the value in the table for each church.

  3. #3
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Morecambe England, Lancashire, England
    Posts
    105
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Global Variables (Windows 98/Office 2000)

    Dear Hans,

    Yet again thank you very much.

    It's rather funny but in the original draft note I had put:-

    "... I realise I could possibly do it with a table, but it is such a pain to have remember to add the table to every query, so that it knows the variable."

    and then scrapped it.

    I hadn't realised that you could use DLookup("Setting" that way. This has opened up a whole new world for lots of other things I can do!

    Many thanks again

    Michael

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •