Case Select Statement issue - no errors, but doesn't "work".

Case Select Statement issue - no errors, but doesn't "work".

RNDinov8r
Collaborator Collaborator
408 Views
2 Replies
Message 1 of 3

Case Select Statement issue - no errors, but doesn't "work".

RNDinov8r
Collaborator
Collaborator

I have written some code to look at different cases (still in progress), so it is meant to flag certain issues with dimensions that are outside of certain ranges. That said, when I comment out the code as seen below, and only run the four or five lines, it seems to work fine, but when I introduce the Select Case Process, it doesn't throw an error, it just seems to no run, or run, but not do anything. I know enough about VB and iLogic to be dangerous, as you can see here.

 

Dim WidWarn As String
Dim WidCalc As Double

'Select Case "ProuductShape"
' Case "Disc"
	WidCalc = PouchWid - MinPouchWid

	If WidCalc > (SealWid / 2) Then
		MessageBox.Show("Pouch Width Too Small", "Width Warning")
	Else
		MessageBox.Show("Pouch Width Acceptable", "Width Warning")
	End If	

'Case "Cylinder"
'	WidCalc = PouchWid - CylMinPouchWid
'
'	If WidCalc > SealWid / 2 Then
'		MessageBox.Show("Pouch Width Too Small", "Width Warning")
'	Else
'		MessageBox.Show("Pouch Width Acceptable", "Width Warning")
	'End If	
'Case "Plate"
'	MessageBox.Show("Pouch not Designed", "Width Warning")
'Case "Half Sphere"
'	If HalfShellTop > 20 deg Then
'		MessageBox.Show("Pouch Length is likely too Short", "Pouch Shape Warning")
'	End If
'	If HalfShellSide > 20 deg Then
'		MessageBox.Show("Pouch Width is likely too Narrow", "Pouch Shape Warning")
'	End If
'End Select

 

0 Likes
Accepted solutions (1)
409 Views
2 Replies
Replies (2)
Message 2 of 3

JelteDeJong
Mentor
Mentor
Accepted solution

after a select case i would expect a variable but in your case ther is a string "ProuductShape". now that case is compared with the strings of your cases "Disc", "Cylinder", "Plate" and "Half Sphere". that will never be true therefor none of your cases will evre be executed.

i expect that "ProuductShape" is a parameter. if so your select case statement should look something like:

Select Case ProuductShape

 notice that i left out the parentheses

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 3 of 3

RNDinov8r
Collaborator
Collaborator

That was it! a stupid syntax error. I even had another rule running a select Case argument, which I had written correctly, and never noticed the difference in Syntax. 

0 Likes