Solved

Case Instructions

Posted on 2000-04-21
2
134 Views
Last Modified: 2010-05-02
Dear friend i wrote a code to make the following:

code to do one of the following actions, depending on the value of Choice:

i.When Choice is 3, 5, or 7, add 1 to a variable called Counter.

ii.When Choice is between 8 and 15 inclusive, set Counter to 0.

iii.When Choice is has any other value,display "invalid code" in a message box,

*****Code begin**********

Dim inChoice As Integer
Dim inCounter As Integer
inCounter = 0
inChoice = Val(Text1)
Select Case inChoice
    Case 3, 5, 7
        inCounter = inCounter + 1
    Case 8 To 15
        inCounter = 0
    Case 1, 2, 4, 6
        MsgBox "Invalid Code!", vbExclamation
        Exit Sub
    Case Is > 15
        MsgBox "Invalid Code!", vbExclamation
        Exit Sub
End Select

*********Code end*****
This code is right?? How can test this code???

Thanks,

Jairo Cardenas
Colombia
0
Comment
Question by:jcardenas
2 Comments
 
LVL 28

Accepted Solution

by:
AzraSound earned 15 total points
ID: 2738839
to test it put a textbox and a command button on your form

paste the above code into the command button's click event

type a number into the textbox and click the button
0
 

Author Comment

by:jcardenas
ID: 2738855
My Friend, i have tested it according your instruction and it work fine.

Thanks and happy easter,

Jairo Cardenas
Colombia
0

Featured Post

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Access 2016 VB code 9 115
Access query that references subform 5 47
Getting warning: You are about to delete 1 row(s) 9 48
VB6 ListBox Question 4 44
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

773 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