-->>Hi,I have developed a Program that accepts the inputs from an Input Box of Interger datatype,but whenever I try to Cancel the Input Box (That means if I decided not to provide any value and Cancel it) I get an Error saying "Type Mismatch" My Variable assigned to It's declared: Dim LQ_Value As Integer and the line that generates an erro is:LQ_Value = InputBox("Plaese Enter The Number of LQ Forms Entered:", "Number of LQ Required.", "Example: 25", 7500, 4000).
-->>So I was wondering if I can have a way to omit this error by validating it...
-->>Tanx
Bile
10
Newbie Poster
Recommended Answers
Jump to PostFirst off inputbox returns a string and your trying to put it into an integer, which might work if the string represents an integer. When it doesn't you get a mismatch. Changing LQ_Value to a string then converting its value to an integer later would work. A simple conditional statment …
Jump to PostNope, inpitbox can accept any value given to it. You have to state that cancel can be accepted by doing it as such -
''In your code BEFORE you open the input box... On Error GoTo Err Inputbox ... ''Rest of your inputbox code here... Exit sub …
All 7 Replies
tinstaafl
1,176
Posting Maven
AndreRet
526
Senior Poster
tinstaafl
1,176
Posting Maven
jhai_salvador
48
Junior Poster
Bile
10
Newbie Poster
AndreRet
526
Senior Poster
jhai_salvador
48
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.