I am trying to change some VBA Code and need some help. Initially this line of code read this way:
If strAccount <> 124 Then . . .
but I need multiple numbers to compare to but not sure how to make this happen. Please see the line marked *** below:
Public Sub SetOK_FlgForGoodAccounts()
Dim strProcedureName As String
strProcedureName = "Sub SetOK_FlgForGoodAccounts"
'called to display error message
If DEBUG_FLG Then On Error GoTo Err_SetOK_FlgForGoodAccoun
ts
Set db = DBEngine.Workspaces(0).Dat
abases(0)
Set rs_Work = db.OpenRecordset("tblWork"
, DB_OPEN_TABLE)
Dim rs_GoodAccounts As Recordset
Set rs_GoodAccounts = db.OpenRecordset("tblGoodA
ccounts", DB_OPEN_TABLE)
Dim flgGoodAccount As Boolean
With rs_Work
.MoveFirst
Do Until .EOF 'cyle through all records
flgGoodAccount = False 'initialize variables for each new row
strUNC = .Fields("Unc")
'******* Changed due to new conversion
strAccount = .Fields("Account")
strDeptID = Nz(.Fields("DeptID"), "")
strOperating_Unit = .Fields("Operating_Unit")
curYTD = .Fields("YTD")
'check for existence in tblGoodAccounts
rs_GoodAccounts.Index = "idxAccount"
rs_GoodAccounts.Seek "=", strAccount
If Not rs_GoodAccounts.NoMatch Then
flgGoodAccount = True
rs_GoodAccounts.Index = "idxAccountDeptID"
rs_GoodAccounts.Seek "=", strAccount, strDeptID
If Not rs_GoodAccounts.NoMatch Then
flgGoodAccount = True
'Else
' rs_GoodAccounts.Index = "idxAccountDeptID"
' rs_GoodAccounts.Seek "=", strAccount, strDeptID
' If Not rs_GoodAccounts.NoMatch Then
' flgGoodAccount = True
' Else
'05/29/03 am; added to make rules for 124 accounts work correctly
*** If strAccount <> ("51191", "51192", "51193", "51250", "51280", "52110", "52111", "52113", "52114", "57190", "57192", "57200", "57216", "57275", "57350", "57351", "57352", "57370", "57390") Then '''''''''''
rs_GoodAccounts.Index = "idxAccount"
rs_GoodAccounts.Seek "=", strAccount
If Not rs_GoodAccounts.NoMatch Then
flgGoodAccount = True
End If
End If '''''''''''
End If
End If
If flgGoodAccount Then
With rs_Work
.Edit
.Fields("OkFlg") = True
.update
End With
End If
Exit Do
.MoveNext
Loop
Exit_SetOK_FlgForGoodAccou
nts:
Set rs_GoodAccounts = Nothing
Set rs_Work = Nothing
Set db = Nothing
Exit Sub
Err_SetOK_FlgForGoodAccoun
ts:
Call DisplayError(Err.number, Err.Description, strProcedureName, Err.Source)
Resume Exit_SetOK_FlgForGoodAccou
nts
End With
End Sub
Start Free Trial