+ Reply to Thread
Results 1 to 7 of 7

store value in integer

  1. #1
    Registered User
    Join Date
    10-19-2009
    Location
    singapore
    MS-Off Ver
    2010,2013
    Posts
    45

    store value in integer

    Hi Pros,

    anyone know what is the best data type that i can store and hold the value in a form.

    my logic flows goes like this, when click on a button,

    Please Login or Register  to view this content.
    however, no matter how many times i click the 'count' is remind at 0 and is supposed to change to 1 when count is 0.

    so what is the data type that can store and hold(which is count = 1) until the application close. I did tired out using tempvar, unfortunately, its not working too..
    Last edited by waka; 06-15-2015 at 02:48 AM.

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: store value in integer

    Shot in the dark here as I don't know what you're trying to do, but try changing:
    Please Login or Register  to view this content.
    To:
    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: store value in integer

    Declare count at the top outside the sub routine
    Attached Files Attached Files
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: store value in integer

    I reckon static is better. The scope is smaller

  5. #5
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: store value in integer

    static wont pass variable if OP wants to use it in another Sub
    not sure why they would though and even if they did they could pass it when they call it i guess

    anyway both options there now

  6. #6
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: store value in integer

    That's kind of the point with keeping scope as small as possible. Generally it's not a good thing to give variables more scope than they absolutely need.

  7. #7
    Registered User
    Join Date
    10-19-2009
    Location
    singapore
    MS-Off Ver
    2010,2013
    Posts
    45

    Re: store value in integer

    although static is working to store and hold the count from 0 to 1. my logic doesnt flow as it is.

    I wanted to create log in form that would counter check, if the user had a security answer stored in the database, if no, the counter were remain as 0 and will prompt user to key in the security answer. and if yes, it would by pass the security answer and log into the main page staright away.

    My codes as follow;

    Please Login or Register  to view this content.
    Last edited by waka; 06-15-2015 at 04:25 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 07-25-2014, 01:28 AM
  2. Replies: 2
    Last Post: 06-30-2013, 03:30 PM
  3. Replies: 3
    Last Post: 10-27-2011, 05:20 PM
  4. [SOLVED] Logical test for integer or non- integer
    By MHRW in forum Excel General
    Replies: 7
    Last Post: 08-04-2011, 12:46 AM
  5. Count the number of occurrences of an integer withing a larger integer
    By nnktran in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-26-2010, 01:04 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1