• Problem with Case Statement? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Problem with Case Statement? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    • This topic has 2 replies, 2 voices, and was last updated 18 years ago.
    Author
    Topic
    #442439

    I have the following code that works OK

    Now I want to make the code dynamic and want to replace: Case “701”, “702”

    With: Case strCPRevCodes ‘”701″, “702”

    The above statement does not work, what am I doing wrong?

    Thanks, John

    Dim strCPRevCodes As String
        
    strCPRevCodes = GetPref("Default CP Revenue Code")
    MsgBox "strCPRevCodes: " & strCPRevCodes
    Viewing 0 reply threads
    Author
    Replies
    • #1065029

      Case strCPRevCodes results in a single case, not in two. You cannot do it this way.

      • #1065151

        After further review you and Charlotte gave me the solution in

        Help With Case Statement? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8) post 533,289

        I knew I saw it somewhere!

        If Contains(GetPref("Default CP Revenue Codes"), Me.lngRevGLDescID.Column(1)) = True Then
                    
                strFilter = "[lngID]=" & Me.lngID                       
                If Me.Dirty Then
                    DoCmd.RunCommand acCmdSaveRecord
                End If
        
                DoCmd.OpenForm "frm_POS_CommonsUsePermit", , , strFilter, , _
                                    acDialog, Me.Form.Name
        End If
        

        Thanks, John

    Viewing 0 reply threads
    Reply To: Problem with Case Statement? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: