Jump to content

Cancel doesn't work?


Recommended Posts

Please forgive me, I am a PC/Network guy that is lacking in his programming/scripting abilities. I painfully got this code together, and it functions great, but I have tried several different ways to make the cancel button kill the script, and I have had no luck. As of right now, clicking it just acts as the "OK" button. I am probably missing something simple, thanks in advance for taking time to help!

CODE:

Global $Patient_Last_Name

Global $Patient_First_Name

Global $Patient_Middle_Inital

Global $Patient_YOB

Global $Patient_MOB

Global $Patient_DOB

_first()

_second()

DirCopy ("C:\Documents and Settings\eric\My Documents\AIT\Template","C:\Documents and Settings\eric\My Documents\AIT\" & $Patient_Last_Name & ", " & $Patient_First_Name & " " & $Patient_YOB & "-" & $Patient_MOB & "-" & $Patient_DOB)

Func _first()

$Patient_Last_Name = InputBox("Please enter", "Patient Last Name")

$Patient_First_Name = InputBox("Please enter", "Patient First Name")

$Patient_Middle_Inital = InputBox("Please enter", "Patient Middle Inital")

$msg = MsgBox (4, "Is the Patient's name correct?", $Patient_Last_Name & ", " & $Patient_First_Name & "," & $Patient_Middle_Inital)

if $msg = 7 Then _first()

EndFunc

Func _second()

$Patient_YOB = InputBox("Please enter", "Patient Year of Birth: 4-Digit")

$Patient_MOB = InputBox("Please enter", "Patient Month of Birth: 2-Digit")

$Patient_DOB = InputBox("Please enter", "Patient Day of Birth: 2-Digit")

$msg=MsgBox (4, "Is the Patient's DOB correct?", $Patient_YOB & "-" & $Patient_MOB & "-" & $Patient_DOB)

if $msg = 7 Then _second()

EndFunc

Link to comment
Share on other sites

Ok, here's how I would do it.

For the Inputboxes, check for Blank Return String and Error code of 1 which means canceled.

$Patient_Last_Name = InputBox("Please enter", "Patient Last Name")
If $Patient_Last_Name = "" And @error = 1 Then Exit
Edited by spudw2k
Link to comment
Share on other sites

Link to comment
Share on other sites

Thank you, that worked like a charm. I hear on a daily basis from people that they wish they had my PC knowledge, I know how they feel because I wish I had you coding knowledge! I should have figured that out, thanks so much for the help!!

Link to comment
Share on other sites

No sweat man. We all started wanting to be coders. Some just have more time to dedicate than others. I'm no expert either, but I'm eager to learn and have the drive to solve. Glad to assist.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...