Solved

counter increment

Posted on 2011-02-27
3
322 Views
Last Modified: 2012-05-11
I have a global counter that is increased from 0 to 50 by a plus and a minus button.

I would like the incrementation to scale so fom 0 to 5 or 5 to 0 in steps of 1 and from 5 to 50 in steps of 5 or -5 if decreasing

my current code works but only in steps of 1 which is a lot of clicks

I tried a case with 0 to 4 with increments of 1
then 5 to 49 with increments of 5
but the counts go beyond 50 my upper limit so it all falls apart
Private Sub BtnVCCPlus_Click()
    Select Case vCCCount
     Case 0
      vCCCount = vCCCount + 1
    Case 1 To 49
     vCCCount = vCCCount + 1
     Case 50
 
 
     
     
     
     End Select
      LblVCCCount.Caption = vCCCount
End Sub
Private Sub BtnVCCMinus_Click()
     Select Case vCCCount
     
     Case 0
     
     Case 1 To 49
        vCCCount = vCCCount - 1
     Case 50
        vCCCount = vCCCount - 1
  
     
     
     
     
     End Select
      LblVCCCount.Caption = vCCCount
End Sub

Open in new window

0
Comment
Question by:PeterBaileyUk
  • 2
3 Comments
 

Author Comment

by:PeterBaileyUk
ID: 34994865
I have almost got there the decrement works but the increment gets to 4 then jumps straight to 10
Private Sub BtnVCCPlus_Click()

     
     If vCCCount >= 0 And vCCCount <= 4 Then vCCCount = vCCCount + 1
      If vCCCount >= 5 And vCCCount <= 49 Then vCCCount = vCCCount + 5
    
     
     
     
     
     
      LblVCCCount.Caption = vCCCount
End Sub
Private Sub BtnVCCMinus_Click()

 If vCCCount >= 1 And vCCCount <= 5 Then vCCCount = vCCCount - 1
      If vCCCount >= 6 And vCCCount <= 49 Then vCCCount = vCCCount - 5
     If vCCCount = 50 Then vCCCount = vCCCount - 5
     
     
     
     

      LblVCCCount.Caption = vCCCount
End Sub

Open in new window

0
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 34994878
up...


Select Case vCCCount
     Case 0 to 4
      vCCCount = vCCCount + 1
    Case 5 To 45
     vCCCount = vCCCount + 5
     Case else  
    ' do nothing
         
     End Select

and down...


Select Case vCCCount
     
      Case 1 to 5
      vCCCount = vCCCount -1
    Case 10 To 50
     vCCCount = vCCCount - 5
     Case else  
    ' do nothing
 End Select
     
     
     
     
     End Select
0
 

Author Closing Comment

by:PeterBaileyUk
ID: 34994892
just couldnt get my head around that one thank you
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now