Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-time error: Type 6

Status
Not open for further replies.

Schrammie

Programmer
Dec 13, 1999
2
US
Hopefully someone can tell me what's wrong with this line of code and how to correct it.<br>
..<br>
Sub cmdCompute_Click() <br>
Format (RT1, &quot;###00.00&quot;)=(.049*V)/((Sa*a125)+(Sa*b125)+(Sa*c125)+(Sa*d125)+(Sa*e125)<br>
lblRT1.Caption = RT1<br>
End Sub<br>
..<br>
All variables (RT1, V, Sa, a125, etc.) are declared as double and values are based on user input.<br>
I am trying to get the result of this equation to display in a label box, lblRT1.<br>
When I run the program, a run-time error type 6 is displayed...so I click on debug and this is the line that's highlited. At first I thought it was just because the result was too big a decimal and that the &quot;Format....&quot; was supposed to care for that. But, alas, I am still getting the same error message.<br>
Any help would be GREATLY appreciated.<br>
(by the way, James, thank you for your help with my last question!)
 
Try this one. And always check the input variables with the functions IsNumeric. If they not numeric, exit the sub<br>
<br>
Sub cmdCompute_Click() <br>
RT1 = (0.049*V)/((Sa*a125)+(Sa*b125)+(Sa*c125)+(Sa*d125)+(Sa*e125)<br>
lblRT1.Caption = Format (RT1,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top