I've got something
weird happening, and I'm hoping someone's encountered this and can suggest a way
to correct this. I've got a script that enters transaction adjustments
into STAR. I'm using the Do...Loop Until structure for the process that
actually enters the transaction. At the top of the Do...Loop structure, I
have the Stable 0.#, DoEvents, and At"". But, sometimes, the script will
enter a value at a prompt, the correct value at the correct prompt, and then
enter that same value at the next prompt, which is the wrong value at the wrong
prompt. This is causing some problems with incorrect data getting
entered.
The two prompts
involved are in inverted order, so after entering at the first prompt, it goes
around through an iteration of the Do...Loop to get to the next
prompt.
I can't understand
why it's acting this way. I must be missing something obvious.
Anyone have any suggestions? I've attached the procedure that's in
question. Maybe another set of eyes can see what I'm
missing.
Henry Taylor - Information Services
perotsystems® -
Supporting Triad at Lutheran Health Network
Ph: (260) 425-3914
Fax: (260) 425-3958
Sub EnterTransactions(ByVal dummy As String) 'This procedure enters the transactions into the batch in STAR.
'Variables
Dim i As Integer
Dim strReadCarrier As String
Dim strReadPlan As String
Dim strReadLineNbr As String
Dim strResponse As String
Dim blnInsPlanFound As Boolean
Dim sTest As String
'Connect to the WEM window
Connect HBOWEMSession, stStream
'Process the records
Do
Stable 0.7
DoEvents
At ""
If At("Enter [EMAIL PROTECTED],1") Then
'set intitial flag value to false
blnInsPlanFound = False
For i = 8 To 22
strReadCarrier = View(Row:=i, Col:=9, Length:=3) '680
strReadPlan = View(Row:=i, Col:=45, Length:=3) '288
strReadLineNbr = View(Row:=i, Col:=2, Length:=2) ' 1
If Trim(strReadCarrier) & Trim(strReadPlan) = mstrInsCarrier &
mstrInsPlan Then
blnInsPlanFound = True
Enter Trim(strReadLineNbr)
Wait 1
strResponse = View(Row:=24, Col:=1, Length:=80)
If Trim(strResponse) = "No Entries Defined" Then
mstrStatus = "No Entries Defined for Insurance " &
mstrInsCarrier & mstrInsPlan
Enter "."
Exit For
Else
Exit For
End If
End If
Next
'the insurance plan is not found at all; set the error response
then back out to the
'starting prompt; the Do Loop will exit processing at the next check
If blnInsPlanFound = False Then
mstrStatus = "Ins Plan " & mstrInsCarrier & mstrInsPlan & " not
found on account"
Enter "."
End If
End If
If At("Enter a batch number, 'A' for a system assigned number or '-'
for a [EMAIL PROTECTED],1") Then
'if somehow the process has backed out too far, run the
ExistingBatch procedure to
'get back to the name prompt
ExistingBatch (mstrBatchNbr)
End If
PauseLoop "Enter Sex (M/F) or [EMAIL PROTECTED],1", ".~"
If At("Enter adjustment amount [EMAIL PROTECTED],1") Then
'test to see if the adjustment amount is a negative number
If mstrAdjAmount < 0 Then
'if it is, then strip off the "-" sign before entering the
transaction amount in STAR
mstrTransAmount = Trim(mstrAdjAmount) * -1
'reformat the transaction amount with the decimal point
mstrTransAmount = Format(mstrTransAmount, "####0.00")
Else 'it's a positive amount
'load the adjustment amount into the transaction amount
variable for entry
mstrTransAmount = mstrAdjAmount
End If
'then grab the account balance for writing back to the Adjustments
table
mstrAcctBal = View(Row:=15, Col:=62, Length:=12) '0.00
'then enter the adjustment amount
Enter mstrTransAmount
Wait 1
'read for an error response from STAR
strResponse = View(Row:=24, Col:=1, Length:=80)
If Trim(strResponse) = "Adjustment amount exceeds Account balance"
Then
mstrStatus = "Error: Adjustment exceeds balance"
Pause "Is this a final disposition? (Y/N) [EMAIL PROTECTED],1"
Enter "."
Pause "Enter field number or '/' starting field [EMAIL
PROTECTED],1"
Enter "."
Pause "Accept this screen? (Y/N) [EMAIL PROTECTED],1"
Enter "."
Exit Sub
End If
Stable 0.5
End If
PauseLoop "Enter transaction code, or '-' for list [EMAIL
PROTECTED],1", Trim(mstrTransCode) & "~"
PauseLoop "Enter choice, (L)ist All, (U)npaid, or (O)ther [EMAIL
PROTECTED],1", "1~"
sTest = View(Row:=13, Col:=24, Length:=5) 'A6426
If sTest = "A0001" Then
'break here
Msg = "Wrong Transaction"
MsgBox Msg
End If
If At("Enter `D`ebit or `C`redit adjustment? (D/C) [C] [EMAIL
PROTECTED],1") Then
If Trim(mstrAdjAmount) < 0 Then
Enter "D"
Else
Enter "C"
End If
End If
PauseLoop "Enter comments (C) or notes (N)[EMAIL PROTECTED],1", "~"
PauseLoop "Is this a final disposition? (Y/N) [EMAIL PROTECTED],1", "~"
If At("Accept this screen? (Y/N) [EMAIL PROTECTED],1") Then
'read the sequence number and trim it
mstrSeqNbr = View(Row:=10, Col:=4, Length:=4) '1
mstrSeqNbr = Trim(mstrSeqNbr)
Enter "Y"
If mstrStatus = "" Then
mstrStatus = "Done"
Else
'do nothing, it's already set to an error
End If
End If
If At("name or `-`name for soundex-- @23,1") And mstrStatus = "" Then
Enter mstrAcctNbr
Wait 1
strResponse = View(Row:=24, Col:=1, Length:=80)
If Trim(strResponse) = "No Entries Defined" Then
mstrStatus = "No Entries Defined for Insurance " &
mstrInsCarrier & mstrInsPlan
End If
End If
PauseLoop "Disposition denied...clear disposition (Y/N) [EMAIL
PROTECTED],1", ".~"
If At("Enter option [EMAIL PROTECTED],1") Then
If At("Adjustment Posting Selection Input [EMAIL PROTECTED],1") Then
'Somehow the processing has escaped from the batch, so
'run the ExistingBatch procedure to get back into the batch
ExistingBatch (mstrBatchNbr)
End If
End If
PauseLoop "Enter a batch number, 'A' for a system assigned number or
'-' for a [EMAIL PROTECTED],1", ".~"
PauseLoop "Batch is out of balance - Accept (A), Print (P) or Edit (E)?
[EMAIL PROTECTED],1", ".~"
At ""
Loop Until At("name or `-`name for soundex-- @23,1") And mstrStatus <> ""
At ""
DoEvents
End Sub
