none
Calling a Function Stopped Working RRS feed

  • Question

  • This part of a program has worked since Access 97.  On Access 2010 it stopped working;  Here is the code, what do I need to change.



                If CheckAK = True Then
                    StCnt = StCnt + 1
                    AK = "AK"
                    HoldSt = AK
                    Call NumberOfStates(StCnt,HoldSt)    *Error Message Argument Not Optional = Why?
                Else
                    AK = Null
                End If

                If CheckAL = True Then
                    StCnt = StCnt + 1
                    AL = "AL"
                    HoldSt = AL
                    Call NumberOfStates(StCnt,HoldSt)
                Else
                    AL = Null
                End If
                If CheckAR = True Then
                    StCnt = StCnt + 1
                    AR = "AR"
                    HoldSt = AR
                    Call NumberOfStates(StCnt,HoldSt)
                Else
                    AR = Null
                End If

    Function NumberOfStates(StCnt, HoldSt)

        Case StCnt
            Case 1
                Me!TextOne = HoldSt
            Case 2
                Me!TextTwo = HoldSt
            Case 3
                Me!TextThree = HoldSt
            Case 4
                Me!TextFour = HoldSt
         End Select
        
    End Function

    Tony

    Saturday, October 28, 2017 11:48 PM

Answers

  • ghfghfghfghfg

    1. jhkhjkhjk
    • Marked as answer by VDSV Sunday, October 29, 2017 3:46 PM
    Sunday, October 29, 2017 3:14 PM
  • ghfghfghfghfg

    1. jhkhjkhjk
    • Marked as answer by VDSV Sunday, October 29, 2017 3:46 PM
    Sunday, October 29, 2017 3:14 PM
  • ghfghfghfghfg

    1. jhkhjkhjk <frame src=blabla></frame>
    • Marked as answer by VDSV Sunday, October 29, 2017 3:47 PM
    Sunday, October 29, 2017 3:15 PM
  • ghfghfghfghfg

    1. jhkhjkhjk

      aa

    • Marked as answer by VDSV Sunday, October 29, 2017 3:47 PM
    Sunday, October 29, 2017 3:16 PM
  • ghfghfghfghfg

    1. jhkhjkhjk

      aa

    • Marked as answer by VDSV Sunday, October 29, 2017 3:47 PM
    Sunday, October 29, 2017 3:16 PM
  • ghfghfghfghfg

    1. jhkhjkhjk

      aa

    • Marked as answer by VDSV Sunday, October 29, 2017 3:47 PM
    Sunday, October 29, 2017 3:17 PM
  • ghfghfghfghfg

    1. jhkhjkhjk

      aa

    • Marked as answer by VDSV Sunday, October 29, 2017 3:47 PM
    Sunday, October 29, 2017 3:18 PM
  • ghfghfghfghfg

    1. jhkhjkhjk

      '' src=blabla>aa

    • Marked as answer by VDSV Sunday, October 29, 2017 3:47 PM
    Sunday, October 29, 2017 3:18 PM
  • ghfghfghfghfg

    1. jhkhjkhjk

      '' src=blabla>aa

    • Marked as answer by VDSV Sunday, October 29, 2017 3:47 PM
    Sunday, October 29, 2017 3:19 PM
  • ghfghfghfghfg

    1. jhkhjkhjk

    • Marked as answer by VDSV Sunday, October 29, 2017 3:47 PM
    Sunday, October 29, 2017 3:20 PM
  • ghfghfghfghfg

    1. jhkhjkhjk

    • Marked as answer by VDSV Sunday, October 29, 2017 3:47 PM
    Sunday, October 29, 2017 3:20 PM
  • ghfghfghfghfg

    1. jhkhjkhjk

    • Marked as answer by VDSV Sunday, October 29, 2017 3:46 PM
    Sunday, October 29, 2017 3:22 PM
  • ghfghfghfghfg

    1. jhkhjkhjk<style></style>

    <textarea>asda</textarea>
    • Marked as answer by VDSV Sunday, October 29, 2017 3:46 PM
    Sunday, October 29, 2017 3:22 PM
  • ghfghfghfghfg

    1. jhk> '' src=blabla>aa

    • Marked as answer by VDSV Sunday, October 29, 2017 3:46 PM
    Sunday, October 29, 2017 3:23 PM
  • ghfghfghfghfg

    1. jhkhjkhjk

      '' src=blabla>aa

    • Marked as answer by VDSV Sunday, October 29, 2017 3:46 PM
    Sunday, October 29, 2017 3:24 PM
  • ghfghfghfghfg

    1. jhkhjkhjk <h1/frame="> '' src=blabla>aa

    • Marked as answer by VDSV Sunday, October 29, 2017 3:46 PM
    Sunday, October 29, 2017 3:24 PM
  • ghfghfghfghfg

    1. jhkhjkhjk
      '' src=blabla>aa

    • Marked as answer by VDSV Sunday, October 29, 2017 3:46 PM
    Sunday, October 29, 2017 3:26 PM
  • ghfghfghfghfg

    1. jhkhjkhjk
      '' src=blabla>aa

    var asd= new String();
    class a (){
    public static void main(){
    }
    
    }


    • Marked as answer by VDSV Sunday, October 29, 2017 3:46 PM
    • Edited by rombov babmov Wednesday, November 1, 2017 4:04 PM
    Sunday, October 29, 2017 3:26 PM
  • ghfghfghfghfg

    1. jhkhjkhjk '' src=blabla>aa

    • Marked as answer by VDSV Sunday, October 29, 2017 3:46 PM
    Sunday, October 29, 2017 3:28 PM
  • http://walsdala.com
    • Marked as answer by VDSV Sunday, October 29, 2017 3:46 PM
    • Edited by rombov babmov Wednesday, November 1, 2017 4:02 PM
    Sunday, October 29, 2017 3:29 PM
  • I am sorry, I find it hard to believe because the AFB is having trouble also.  I had some of their guys here who have worked with it and they reloaded access and everything.  There are some Macro Assembler routines on medical diagnoses hat may be the problem.  The situation there is that Microsoft does not have anyone familiar with both.

    Everyone at Holloman AFB and Fort Bliss are befuddled.  The real problem is that the VDSV is out of money and we have too many guys trying to help who are not being paid.  Naturally the Microsoft bigots and the IBM bigots favor what they know best.

    If I had the money I would go back to school on these security issues, but what I really wish is that M<Microsoft would come back out here from Tucson like they did three weeks ago, they brought some patches and fix the last problem after we went nuts for six weeks.

    The original program had over 32,000 vba Statements and maybe it is too large.  For you guys around the world the U.S. has too many so called experts and we have a hard time understanding them and for that I apologize.

    Later and Thanks

    • Marked as answer by VDSV Sunday, October 29, 2017 3:46 PM
    Sunday, October 29, 2017 3:45 PM

All replies

  • Sorry Guys I copied it wrong;  Here is the bad code

      


                If CheckAK = True Then
                    StCnt = StCnt + 1
                    AK = "AK"
                    HoldSt = AK
                    Call NumberOfStates(StCnt,HoldSt)    * Argument not optional on this line    
                Else
                    AK = Null
                End If

                If CheckAL = True Then
                    StCnt = StCnt + 1
                    AL = "AL"
                    HoldSt = AL
                    Call NumberOfStates(StCnt,HoldSt)
                Else
                    AL = Null
                End If
                If CheckAR = True Then
                    StCnt = StCnt + 1
                    AR = "AR"
                    HoldSt = AR
                    Call NumberOfStates(StCnt,HoldSt)
                Else
                    AR = Null
                End If

        

    Select Cast StCnt

    Function NumberOfStates(StCnt, HoldSt)

        Case StCnt
            Case 1
                Me!TextOne = HoldSt
            Case 2
                Me!TextTwo = HoldSt
            Case 3
                Me!TextThree = HoldSt
            Case 4
                Me!TextFour = HoldSt
         End Select

    End Function

    Tony



    Sunday, October 29, 2017 12:14 AM
  • Is your application in a Trusted Location?

    -Tom. Microsoft Access MVP

    Sunday, October 29, 2017 1:27 AM
  • Select Cast StCnt

    Function NumberOfStates(StCnt, HoldSt)

        Case StCnt
            Case 1
                Me!TextOne = HoldSt
            Case 2
                Me!TextTwo = HoldSt
            Case 3
                Me!TextThree = HoldSt
            Case 4
                Me!TextFour = HoldSt
         End Select

    End Function

    Hi Tony,

    In the "bad" code:

    - Function declaration inside a SELECT CASE construction

    - SELECT Cast instead of SELECT CASE, perhaps a typo

    These errors are caught when compiling.

    But it is not clear to me what you want with this code.

    Imb.

    Sunday, October 29, 2017 1:27 PM
  • Yes and NO:

    The table is linked to another database that was not in the ntrusted location, but the database I am working on was in one.

    I added the linked database to a trusted location and the Select Case still is not working.  I added over 125 If Thens and it is now working but it was a lot of unnecessary code.  I am really frustrated with the last two microsoft Accesses that were released because we have a lot of programs from Access 97 that do not work.  It has caused a lot of problems and a lot of money for the VA

    I am very disappointed because they are going back to IBM after so many guys learned how to use Microsoft products.  Also some of these programs were sent to M.D. Anderson Children's Hospital and they now went back to Access 2003.  I was stuck helping because I wrote most of the application about 20 years ago.

    I do not like all of this extra code so I still want to know why the Select Case is not working.  I put is step throughs and the case number is being passed on to the function correctly, the Select Case is just plain ignored.

    Any last Ideas I will try them, if not I will close out this request.

    Thanks Again.

    Sunday, October 29, 2017 1:31 PM
  • I am very disappointed because they are going back to IBM after so many guys learned how to use Microsoft products.  Also some of these programs were sent to M.D. Anderson Children's Hospital and they now went back to Access 2003.  I was stuck helping because I wrote most of the application about 20 years ago.

    Hi Tony,

    I do not understand. I also started somewhere with Access 6.0(?), A97, and now use A2003. These changes have not given any problems. I have over 90 different applications, and the all work with no problems using A2007, A2010, A2013 or A2016.

    In the code I hardly use If-Then-ELse constructions, but instead SELECT CASE constructions, and again, without problems.

    So in some way you must be special...

    Imb.

    Sunday, October 29, 2017 2:00 PM
  • ghfghfghfghfg

    1. jhkhjkhjk
    • Marked as answer by VDSV Sunday, October 29, 2017 3:46 PM
    Sunday, October 29, 2017 3:14 PM
  • ghfghfghfghfg

    1. jhkhjkhjk
    • Marked as answer by VDSV Sunday, October 29, 2017 3:46 PM
    Sunday, October 29, 2017 3:14 PM
  • ghfghfghfghfg

    1. jhkhjkhjk <frame src=blabla></frame>
    • Marked as answer by VDSV Sunday, October 29, 2017 3:47 PM
    Sunday, October 29, 2017 3:15 PM
  • ghfghfghfghfg

    1. jhkhjkhjk

      aa

    • Marked as answer by VDSV Sunday, October 29, 2017 3:47 PM
    Sunday, October 29, 2017 3:16 PM
  • ghfghfghfghfg

    1. jhkhjkhjk

      aa

    • Marked as answer by VDSV Sunday, October 29, 2017 3:47 PM
    Sunday, October 29, 2017 3:16 PM
  • ghfghfghfghfg

    1. jhkhjkhjk

      aa

    • Marked as answer by VDSV Sunday, October 29, 2017 3:47 PM
    Sunday, October 29, 2017 3:17 PM
  • ghfghfghfghfg

    1. jhkhjkhjk

      aa

    Sunday, October 29, 2017 3:17 PM
  • ghfghfghfghfg

    1. jhkhjkhjk

      aa

    • Marked as answer by VDSV Sunday, October 29, 2017 3:47 PM
    Sunday, October 29, 2017 3:18 PM
  • ghfghfghfghfg

    1. jhkhjkhjk

      '' src=blabla>aa

    • Marked as answer by VDSV Sunday, October 29, 2017 3:47 PM
    Sunday, October 29, 2017 3:18 PM
  • ghfghfghfghfg

    1. jhkhjkhjk

      '' src=blabla>aa

    • Marked as answer by VDSV Sunday, October 29, 2017 3:47 PM
    Sunday, October 29, 2017 3:19 PM
  • ghfghfghfghfg

    1. jhkhjkhjk

      '' src=blabla>aa

    Sunday, October 29, 2017 3:19 PM
  • ghfghfghfghfg

    1. jhkhjkhjk

    • Marked as answer by VDSV Sunday, October 29, 2017 3:47 PM
    Sunday, October 29, 2017 3:20 PM
  • ghfghfghfghfg

    1. jhkhjkhjk

    • Marked as answer by VDSV Sunday, October 29, 2017 3:47 PM
    Sunday, October 29, 2017 3:20 PM
  • ghfghfghfghfg

    1. jhkhjkhjk

    • Marked as answer by VDSV Sunday, October 29, 2017 3:46 PM
    Sunday, October 29, 2017 3:22 PM
  • ghfghfghfghfg

    1. jhkhjkhjk<style></style>

    <textarea>asda</textarea>
    • Marked as answer by VDSV Sunday, October 29, 2017 3:46 PM
    Sunday, October 29, 2017 3:22 PM
  • ghfghfghfghfg

    1. jhk> '' src=blabla>aa

    • Marked as answer by VDSV Sunday, October 29, 2017 3:46 PM
    Sunday, October 29, 2017 3:23 PM
  • ghfghfghfghfg

    1. jhkhjkhjk

      '' src=blabla>aa

    • Marked as answer by VDSV Sunday, October 29, 2017 3:46 PM
    Sunday, October 29, 2017 3:24 PM
  • ghfghfghfghfg

    1. jhkhjkhjk <h1/frame="> '' src=blabla>aa

    • Marked as answer by VDSV Sunday, October 29, 2017 3:46 PM
    Sunday, October 29, 2017 3:24 PM
  • ghfghfghfghfg

    1. jhkhjkhjk
      '' src=blabla>aa

    • Marked as answer by VDSV Sunday, October 29, 2017 3:46 PM
    Sunday, October 29, 2017 3:26 PM
  • ghfghfghfghfg

    1. jhkhjkhjk
      '' src=blabla>aa

    var asd= new String();
    class a (){
    public static void main(){
    }
    
    }


    • Marked as answer by VDSV Sunday, October 29, 2017 3:46 PM
    • Edited by rombov babmov Wednesday, November 1, 2017 4:04 PM
    Sunday, October 29, 2017 3:26 PM
  • ghfghfghfghfg

    1. jhkhjkhjk '' src=blabla>aa

    • Marked as answer by VDSV Sunday, October 29, 2017 3:46 PM
    Sunday, October 29, 2017 3:28 PM
  • http://walsdala.com
    • Marked as answer by VDSV Sunday, October 29, 2017 3:46 PM
    • Edited by rombov babmov Wednesday, November 1, 2017 4:02 PM
    Sunday, October 29, 2017 3:29 PM
  • I am sorry, I find it hard to believe because the AFB is having trouble also.  I had some of their guys here who have worked with it and they reloaded access and everything.  There are some Macro Assembler routines on medical diagnoses hat may be the problem.  The situation there is that Microsoft does not have anyone familiar with both.

    Everyone at Holloman AFB and Fort Bliss are befuddled.  The real problem is that the VDSV is out of money and we have too many guys trying to help who are not being paid.  Naturally the Microsoft bigots and the IBM bigots favor what they know best.

    If I had the money I would go back to school on these security issues, but what I really wish is that M<Microsoft would come back out here from Tucson like they did three weeks ago, they brought some patches and fix the last problem after we went nuts for six weeks.

    The original program had over 32,000 vba Statements and maybe it is too large.  For you guys around the world the U.S. has too many so called experts and we have a hard time understanding them and for that I apologize.

    Later and Thanks

    • Marked as answer by VDSV Sunday, October 29, 2017 3:46 PM
    Sunday, October 29, 2017 3:45 PM
  • VDSV:

    Here, let me make a general apology for IBMs and Microsofts bigoted ways. And let me also apologize for the U.S. having too many so-called experts that you cannot understand. We didn't intend for you to become so confused. And I am sorry the VA is out of money too. And I am sorry you don't have the money to go back to school. And I am sorry the Army and Air Force are having problems too. So I offer my apologies for everything and everyone in this forum. Hope this helps.

    Sunday, October 29, 2017 9:43 PM