Results 1 to 4 of 4
  1. #1
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496

    Public variable not updating for each function

    In one module I have made some public variables - one of which is a string

    in other modules I have functions that change that string, sort of update it depending on what task it is.

    For some reason if one function changes it, only the first will change it. The others don't update the string and I can't figure out why



    Any suggestions?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,924
    Show code.

    These variables are referenced by various modules? The variables are declared in header of a general module? Or are they used by procedures of only one module?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    Show code.

    These variables are referenced by various modules? The variables are declared in header of a general module? Or are they used by procedures of only one module?
    I had it in each public sub or function in (I'm pretty sure no functions) which are in different modules.

    I have a module that just declares the variables for use in other ones - the one I can't change is the nav variable highlighted in the image

    I'm wondering if because the variable is declared in one module you can't change it in another??

    Click image for larger version. 

Name:	Capture.PNG 
Views:	5 
Size:	16.3 KB 
ID:	17957

    note: because I am using PHP on the site I have to change the link to the navigation for every html page that is built - so each task gets their own path of the url.

    I think I have to change the variable into a string function and call the variable (with the path passed through) each time.

    So I think I have just solved it...

  4. #4
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    yup I solved it (thanks to your help - it made me think about what I was doing)

    I basically made a string variable strHTMLTop and thought I could change the variable in the string which wasn't going to work just by changing the variable in the string before it was called.

    I converted it to a string function and passed the url I wanted each time it was called - easy fix. Now it works.

    Thanks

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 08-03-2014, 07:48 PM
  2. Replies: 1
    Last Post: 01-04-2014, 09:44 PM
  3. How to use global/public variable
    By mrbabji in forum Programming
    Replies: 7
    Last Post: 05-18-2013, 10:08 PM
  4. Making a Public Function more flexible
    By sjs94704 in forum Programming
    Replies: 2
    Last Post: 12-10-2012, 02:21 PM
  5. Replies: 9
    Last Post: 12-20-2010, 08:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums