Advertisement

07.05.2007 at 08:21AM PDT, ID: 22677011
[x]
Attachment Details

MS Access 97 VBA

Asked by deer777 in Access Coding/Macros

Tags: access, 97, vba

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_FlgForGoodAccounts

    Set db = DBEngine.Workspaces(0).Databases(0)
    Set rs_Work = db.OpenRecordset("tblWork", DB_OPEN_TABLE)
   
    Dim rs_GoodAccounts As Recordset
    Set rs_GoodAccounts = db.OpenRecordset("tblGoodAccounts", 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_FlgForGoodAccounts:
    Set rs_GoodAccounts = Nothing
    Set rs_Work = Nothing
    Set db = Nothing
    Exit Sub
 
Err_SetOK_FlgForGoodAccounts:
    Call DisplayError(Err.number, Err.Description, strProcedureName, Err.Source)
    Resume Exit_SetOK_FlgForGoodAccounts
    End With
End SubStart Free Trial
[+][-]07.05.2007 at 08:24AM PDT, ID: 19424816

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.05.2007 at 08:28AM PDT, ID: 19424852

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Access Coding/Macros
Tags: access, 97, vba
Sign Up Now!
Solution Provided By: bruintje
Participating Experts: 3
Solution Grade: A
 
 
[+][-]07.06.2007 at 12:05AM PDT, ID: 19429993

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.06.2007 at 12:39AM PDT, ID: 19430087

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.06.2007 at 12:40AM PDT, ID: 19430091

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.06.2007 at 12:44AM PDT, ID: 19430100

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32