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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript getting Expected 'End' error --- HELP

Status
Not open for further replies.

RJ Jackson

Technical User
Jul 24, 2018
12
0
0
US
VB Script Error: C:\Users\hrjco\AppData\Local\Adersoft\VbsEdit\Temp\OCDEZEYU.vbs(3, 3) Microsoft VBScript compilation error: Expected 'End'
Purpose of script: I'm essentially trying to see if variable GetDocALIAS = "A587" then the variable GetDOCTYPE will be stored as Doc1, if it's not A587, and it's A588, then GetDOCTYPE will be Doc2, etc etc.

What am I missing here? HELP!!!

Function GetDOCTYPE(text)
IF GetDOCALIAS = "A586" then GetDOCTYPE = "Colonoscopy Orders"
Else GetDOCALIAS = "A587" then GetDOCTYPE = "Ercp Orders"
ElseIF GetDOCALIAS = "A588" then GetDOCTYPE = "Flex Sigmoidoscopy Orders"
ElseIF GetDOCALIAS = "A589" then GetDOCTYPE = "Peg Orders"
ElseIF GetDOCALIAS = "A590" then GetDOCTYPE = "Upper Endoscopy Orders"
END IF
End Function
 
Hi,
Code:
Function GetDOCTYPE(text)
IF GetDOCALIAS = "A586" then GetDOCTYPE = "Colonoscopy Orders"
Else[b]IF[/b] GetDOCALIAS = "A587" then GetDOCTYPE = "Ercp Orders"
ElseIF GetDOCALIAS = "A588" then GetDOCTYPE = "Flex Sigmoidoscopy Orders"
ElseIF GetDOCALIAS = "A589" then GetDOCTYPE = "Peg Orders"
ElseIF GetDOCALIAS = "A590" then GetDOCTYPE = "Upper Endoscopy Orders"
END IF

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Wow! Totally Awesome! Makes sense...it's the little stuff! What do you think about the below? Getting the same Expected End. From what I can see, everything is good. Essentially I'm taking a date like 05181984 and making it 05/18/1984.

Function ReformatDOS(YMD)
ReformatDOS = Mid(YMD,1,2) & "/" & Mid(YMD,3,2) & "/" Mid(YMD,5,4)
End Function
 
Code:
Function ReformatDOS(YMD)
ReformatDOS = Mid(YMD,1,2) & "/" & Mid(YMD,3,2) & "/" [b]&[/b] Mid(YMD,5,4)
End Function

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
You missed a concatenation operator.

BTW, I like this better
Code:
Function GetDOCTYPE(text)
Select Case GetDOCALIAS
    Case "A586": GetDOCTYPE = "Colonoscopy Orders"
    Case "A587": GetDOCTYPE = "Ercp Orders"
    Case "A588": GetDOCTYPE = "Flex Sigmoidoscopy Orders"
    Case "A589": GetDOCTYPE = "Peg Orders"
    Case "A590": GetDOCTYPE = "Upper Endoscopy Orders"
End Select

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Dang It! I was so sleepy! I gotcha...on both! So awesome! I need to get to learning this better! I appreciate all of your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top