Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Bad Object Handle

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    RE: Bad Object Handle

    Sorry Gabe - the expression used was

    if(Deal_Num"1001,1001,Deal_Num)

    Deal_Num was a global variable.

    The expression was used in the form's OnInit event. Tom recently helped me with a similar problem where he used the OnActivate event, not OnInit. Maybe that's the cure - I haven't had time to check it out yet.
    Mike

    Comment


      #17
      RE: Bad Object Handle

      Gabe,

      The form I am referencing was designed in A5V5. It's based on a table (charges) which is part of a set (proprerties). The field rule for invoice number is auto-increment. Hope this info helps. Deb

      Mike,

      Thanks for your feedback. I'll let you know if I come across something that will be helpful to both of us. Deb

      Comment


        #18
        RE: Bad Object Handle

        Deb:
        I don't think you situation is the same as Mike's even though you are getting the same error.
        What does the trace window say?
        Open the form in design mode, and see if there are object that reference non existing fields or variables or most likely referncing your old database.
        Gabe

        Comment


          #19
          RE: Bad Object Handle

          Mike:
          Sorry I didn't get back with you sooner, I had an urgent matter to take care of.

          None withstanding the error message, I don't quite understand how is it possible that this script would work?

          For a starter:
          The place for this script is not in OnInint nor OnActivate, perhaps OnSave
          2-The expression should be if(var-"Deal_Num"1001,1001,var-"Deal_Num)
          3-You are trying to make an "illegal U-Turn" and the cops happened to be watching !! : Alpha's built-in Auto-increment has no sense of humor, the next increment MUST be higher than the latest, period. It does not have to be in-sequence, but it MUST be higher. And for a good reason, so you don't duplicate a number that has been used previously.

          So when you say that the script works, I do not see how could that be possible?

          You have three issues here:
          1-How to fix what you have to make it work the way you want it?: I say: abandon it. Not only it won't work but it seems to be fraught with errors as well.
          2-Why is the error messages and what does it mean?
          It would be hard to answer that not knowing what the full script is, but I think this is a moot point now.
          3-If you abandon what you have, what is the alternative?
          By definition what you need is not an autoincrement but rather a calculated field.
          Auto-increment is a follower not a leader ! It does what you tell it to do and follows these rules blindly. It is not meant to think except just to add one increment. That's all.
          Calculated entry on the other hand, will do the thinking.
          I suppose, you are going to ask me: If I use a calculated entry instead of auto-increment then how do I get the field to increment in case DEAL_NUM is "1001 ?
          Simple:
          Here is the expression you need:
          field1=if(var-"Deal_Num"1001,1001,tablemax()+1)

          Gabe

          Comment


            #20
            RE: Bad Object Handle

            Gabe Your advice is much appreciated. I got round the problem temporarily by making the field in the table a simple auto increment with no calculations/events at all. This works OK except that I couldn't start at 1001 when there were no records in the file (they were all cleared at the Month End).

            I seem to remember that the code I quoted was OK when I tested it by displaying the Deal_Num variable in a message box but it did not display in Field1 on the form due to the error I reported. Incidently, I know I should use var-" before the variable name but sometimes calcs work without it. I must get out of this bad habit!

            Now you have explained how auto increment works and provided me with the obvious solution I can achieve what I wanted originally. Many thanks for your analysis and help. Mike

            Comment


              #21
              RE: Bad Object Handle

              Gabe Your advice is much appreciated. I got round the problem temporarily by making the field in the table a simple auto increment with no calculations/events at all. This works OK except that I couldn't start at 1001 when there were no records in the file (they were all cleared at the Month End).

              I seem to remember that the code I quoted was OK when I tested it by displaying the Deal_Num variable in a message box but it did not display in Field1 on the form due to the error I reported. Incidently, I know I should use var-" before the variable name but sometimes calcs work without it. I must get out of this bad habit!

              Now you have explained how auto increment works and provided me with the obvious solution I can achieve what I wanted originally. Many thanks for your analysis and help. Mike

              Comment


                #22
                RE: Bad Object Handle

                Correction:
                field1=if(var->Deal_Numtablemax()+1)
                field1=if(var->Deal_Num
                Gabe

                Comment


                  #23
                  RE: Bad Object Handle

                  Mike:
                  "I couldn't start at 1001 when there were no records in the file "

                  You need a script, something like:

                  tbl = table.open("c:\.............dbf")
                  count = tbl.records_get()
                  if count=0
                  field1=1001
                  else
                  field1=field1+1
                  endif

                  No need for autoincrement or calculated fields.
                  Gabe

                  Comment


                    #24
                    RE: Bad Object Handle

                    Great - thanks once more for your help Gabe. That seems to be it. Mike.

                    Comment


                      #25
                      RE: Bad Object Handle

                      Mike:
                      For the purpose of completion, here is an alternative way to do that:
                      1-Use auto-increment as you did
                      2-Use a default value of 1001
                      3-When you purge all records, pack the table and you should be able to start from 1001.
                      Gabe

                      Comment


                        #26
                        RE: Bad Object Handle

                        Gabe - Setting the default auto increment value to 1001 was the first thing I tried originally. I doesn't work unless there has been a recent update to V6 which corrected it. I haven't tried it again lately. Mike

                        Comment


                          #27
                          RE: Bad Object Handle

                          As I said, you will need to PACK the table, that way it will start back from 1001.
                          Gabe

                          Comment


                            #28
                            RE: Bad Object Handle

                            Gabe - I did include a pack routine originally. I will try again as per your suggestion but am away for a few days so won't be able to get back immediately. Thanks again. Mike

                            Comment


                              #29
                              RE: Bad Object Handle

                              Gabe - Sorry to be so late getting back to you. I have re-checked using 1001 as the default field rule with Version 6 v2051 and I wrote a test database (attached).

                              There is something very strange happening.

                              Before I used the Clear Deals routine which uses actionscripting to first of all empty (zap) the Deals table and then Pack it, when the Enter New Deal was first used, the DealNo came up as 0. I altered this to 1 and the next new deal auto incremented to 2. I therefore decided that there was a bug.

                              However .... I then proceeded with the Clear Deals routine to test my action scripting after which I Entered a New Deal and the DealNo came up as 1001 (this was after the Zap and Pack).

                              It would seem that Pack is needed before a new record is entered in the table for the very first time! I would be interested to hear if this is the case.

                              Mike

                              Comment


                                #30
                                RE: Bad Object Handle

                                "It would seem that Pack is needed before a new record is entered in the table for the very first time! "
                                Yes.
                                I didn't open your test table, but as I said all along, you need to pack the table first.
                                Gabe

                                Comment

                                Working...
                                X