Hello everyone,
It's been a year and a half since I've done any programming, and it's amazing what I've forgotten. I spend yesterday remembering how to do cascading combo boxes, and todays challenge is this piece of code.
I receive the error in the title when I try and run this...It won't let me step through....
I've tried breaking down the code to ascertain what is causing it. Even brought it down to here:
But it still errors out. I'm sure it must be something stupid, and I'll be embarrassed that I put this out there, but I need to understand what's happening...
PS. The two other functions it's calling works fine...
Thanks everyone!
It's been a year and a half since I've done any programming, and it's amazing what I've forgotten. I spend yesterday remembering how to do cascading combo boxes, and todays challenge is this piece of code.
Code:
Public Function WidthCalc(WidthInput As Double, SubtypeID As Integer)
'declare variables
Dim min As Integer
Dim max As Integer
Dim x As Double
Dim intWidthInput As Integer
'convert WidthInput to integer for Select Case
intWidthInput = CInt(WidthInput)
Debug.Print intWidthInput
'Ensure that the value is between the min and max values for that cabinet subtype
min = 1 'FindMinWidth(SubtypeID)
max = 30 'FindMaxWidth(SubtypeID)
Select Case intWidthInput
Case Is < min
MsgBox "Value entered is too small for selected cabinet type. Please try again."
Case Is > max
MsgBox "Value entered is too large for selected cabinet typ. Please try again."
End Select
'Populate variable
x = WidthInput / 3
x = Round(x, 0)
x = x + 3
Debug.Print x
End Function
I receive the error in the title when I try and run this...It won't let me step through....
I've tried breaking down the code to ascertain what is causing it. Even brought it down to here:
Code:
Public Function WidthCalc2(WidthInput As Double, SubtypeID As Integer) As Integer
'declare variables
WidthCalc2 = 1
MsgBox WidthCalc2
End Function
But it still errors out. I'm sure it must be something stupid, and I'll be embarrassed that I put this out there, but I need to understand what's happening...
PS. The two other functions it's calling works fine...
Thanks everyone!