Invalid Procedure Call error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sasasasa
    New Member
    • Apr 2010
    • 29

    Invalid Procedure Call error

    Hi,
    I am getting the error saying 'Invalid Procedure Call' in my query. My query is very simple. I am just getting data from another query which is getting data from a table.

    SELECT
    Last(ProperCase (qryCustomerInf o.[Last Name]))
    FROM qryCustomer

    The qryCustomer is working fine and returning all the required rows but I don't have any idea why getting the last name is causing problem. Please help.
  • Mariostg
    Contributor
    • Sep 2010
    • 332

    #2
    Hello.
    You probably want something like this:
    Code:
    SELECT 
    Last(StrConv(qryCustomerInfo.[Last Name]),3)
    FROM qryCustomer
    The 3 in the expression will render ProperCase, 2 would give lowercase and 1 uppercase.

    Comment

    • MMcCarthy
      Recognized Expert MVP
      • Aug 2006
      • 14387

      #3
      Where did you get the ProperCase function from? Have you tried running the query without it.

      Comment

      • sasasasa
        New Member
        • Apr 2010
        • 29

        #4
        If I use ProperCase(qryC ustomerInfo.[Last Name]), it works fine. If a customer's Last Name is ABC the it is converted to Abc. But when I add Last to the query it is causing problem. I think there is some problem in the data. But I don't know what can it be.

        If I use Last(StrConv(qr yCustomerInfo.[Last Name],3)) then also it is saying Invalid procedure call. I don't know what is really happening. Please help me.

        Comment

        • Mariostg
          Contributor
          • Sep 2010
          • 332

          #5
          As far as I know, ProperCase does not exist, at least in Access 2003... That is why I proposed StrConv

          In adidtion, you refer to qryCustomerInfo .[Last Name]
          While you specify FROM qryCustomer... Something is not quite right here. I think in both it has to be the same.

          Comment

          • sasasasa
            New Member
            • Apr 2010
            • 29

            #6
            I am sorry it is the same. It is qryCustomerInfo . Just a typing mistake here. My query is working fine if I get the data from a different table. I tried with StrConv but it is still displaying the same error.

            Comment

            • sasasasa
              New Member
              • Apr 2010
              • 29

              #7
              I tried using only Last(qryCustome rInfo.[Last Name]) and it is still giving the same error. How can I find if there is something wrong in the data? Is there any other alternative of Last function?

              Comment

              • Mariostg
                Contributor
                • Sep 2010
                • 332

                #8
                I am getting clueless but can your run:
                Code:
                SELECT 
                qryCustomerInfo.[Last Name]
                FROM qryCustomerInfo

                Comment

                • sasasasa
                  New Member
                  • Apr 2010
                  • 29

                  #9
                  Yes, this runs fine.
                  My actual query is :
                  SELECT
                  qryCustomerInfo .[Number],
                  Last(qryCustome rInfo.[Last Name]) AS [LastOfLast Name], Last(qryCustome rInfo.[Phone])
                  FROM qryCustomerInfo
                  GROUP BY qryCustomerInfo .[Number]

                  Phone numbers are duplicate and I just want their last Phone numbers, so I am using this Last function.

                  I tried with only

                  SELECT
                  Last(qryCustome rInfo.[Last Name])
                  FROM qryCustomerInfo

                  it doesn't work. But it works if I remove

                  Last(qryCustome rInfo.[Last Name])

                  from my query. Phone numbers and Customer Numbers show up.

                  Your query worked just fine. But it has duplications. Last function is not working with Last Name.

                  Comment

                  • Mariostg
                    Contributor
                    • Sep 2010
                    • 332

                    #10
                    Looks like you Select last of [last name] twice:
                    One here
                    Code:
                    SELECT 
                    qryCustomerInfo.[Number],
                    Last(qryCustomerInfo.[Last Name]) AS [LastOfLast Name], Last(qryCustomerInfo.[Phone])
                    FROM qryCustomerInfo
                    GROUP BY qryCustomerInfo.[Number]
                    and one here:
                    Code:
                    SELECT 
                    Last(ProperCase(qryCustomerInfo.[Last Name]))
                    FROM qryCustomerInfo
                    But qryCustomerInfo .[Last Name] does not exist.
                    qryCustomerInfo .[LastOfLast Name] exists on the other hand...
                    Not sure if you follow me.

                    So what you want is this
                    Code:
                    SELECT  
                    Last(ProperCase(qryCustomerInfo.[LastOfLast Name])) 
                    FROM qryCustomerInfo

                    Comment

                    • sasasasa
                      New Member
                      • Apr 2010
                      • 29

                      #11
                      I know I am confusing you. But actually I changed my query, as ProperCase was not a big issue for me, I removed it. I am using only

                      Last(qryCustome rInfo.[Last Name]) AS [LastOfLast Name]

                      now. So that I can make the normal query to work first and forget about Upper case or Lower case. So the query is just this

                      SELECT
                      qryCustomerInfo .[Number],
                      Last(qryCustome rInfo.[Last Name]) AS [LastOfLast Name], Last(qryCustome rInfo.[Phone])
                      FROM qryCustomerInfo
                      GROUP BY qryCustomerInfo .[Number]

                      Comment

                      • MMcCarthy
                        Recognized Expert MVP
                        • Aug 2006
                        • 14387

                        #12
                        Try something for me ...

                        Code:
                        SELECT qryCustomerInfo.[Number],
                        Last(qryCustomerInfo.[Last Name]) AS [LastOfLast Name], qryCustomerInfo.[Phone]
                        FROM qryCustomerInfo
                        GROUP BY qryCustomerInfo.[Number], qryCustomerInfo.[Phone]
                        Does this give you the result you want?

                        Comment

                        • sasasasa
                          New Member
                          • Apr 2010
                          • 29

                          #13
                          Yes, this works. Thank you sooooo much.

                          Comment

                          • MMcCarthy
                            Recognized Expert MVP
                            • Aug 2006
                            • 14387

                            #14
                            You're welcome :)

                            Comment

                            Working...