Alpha Video Training
Results 1 to 6 of 6

Thread: Bad Object Handle

  1. #1
    Zod Mansour
    Guest

    Default Bad Object Handle


    I followed the suggestion of using action scripting to open a form and look into a field to match a record on the target form. If I open the form without any matches the form opens but when I chose a match that Action Genie offers I get a bad object handle! Anyone has had this?

    thx,
    Zod

  2. #2
    Alpha Software Employee Selwyn Rabins's Avatar
    Real Name
    Selwyn Rabins
    Join Date
    Mar 2000
    Location
    Boston, MA
    Posts
    5,302

    Default RE: Bad Object Handle

    zip up your app and let's take a look at it.

    your code might be referencing an object after the object has been closed.

  3. #3
    Zod Mansour
    Guest

    Default RE: Bad Object Handle

    The interesting thing is that I am just using the Action Genie. So it should do the proper checkings. The files are attached.

    thx,
    Zod

  4. #4
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Bad Object Handle

    I see the problem you are having. The "Statement" button on the Customer form generates it.

    Using the latest build on my Win XP Pro system I created a new form for the "Statement_set" using the default form for the set as the template. No other changes to the new form occurred.

    I then dropped a new button on your Customer form and used Action Scripting to open the new form. I used the option to limit the target form's range of records to those where the ID field in the Statement_header table matched the Cust_id field in your Customer form. It worked fine.

    At this point I can't tell you what's wrong with your form or button. I suspect corruption in the called (target) form.

    Recommend you verify you have the latest build of A5V6 and then try again with a new target form.

    -- tom

  5. #5
    Alpha Software Employee Selwyn Rabins's Avatar
    Real Name
    Selwyn Rabins
    Join Date
    Mar 2000
    Location
    Boston, MA
    Posts
    5,302

    Default RE: Bad Object Handle

    the problem is not the xbasic generated by the genie on the button that opens the form.

    the problem is the xbasic that you wrote in the onInit event of the 'statement' form.

    you have

    Var-"Month.value=left(cmonth(date()),3)
    Var-"Year.value=cyear(date())
    topparent:Month.value=Var-"Month.value
    topparent:Year.value=Var-"Year.value
    topparent.refresh_fields()


    this xbasic is incorrect because:

    1. you have a variabled called 'month'. however, the control that displays this variable on the form has a name of 'month0' (which you will see if you right click on the object and select Properties and then go to the 'setup' tab.

    you can't reference the .value property of a variable name. variable names don't have any properties. so a5 is telling you that var-"month is not an object (the 'bad object handle' message is, i would have to say, a little cryptic, but it does make sense)

    what you have to say is

    month0.value = left(cmonth(date()),3)

    since 'month0' IS an object.

    as a matter of personal preference, I generally set the .text property of controls because that way you don't have to know what the variable's data type is. the text property is always character.

    so i would rewrite it as

    month0.text = left(cmont(date()),3)


    similarly

    Var-"Year.value=cyear(date())

    becomes

    year0.text = cyear(date())


    because 'year0' is the object name

    then, you can delete the next two lines (i don't understand what these were meant to do)

    topparent:Month.value=Var-"Month.value
    topparent:Year.value=Var-"Year.value

  6. #6
    Zod Mansour
    Guest

    Default RE: Bad Object Handle


    Thanks for the info. Very helpful indeed.
    You mentioned the text property of a control. Can't find much info on this property in the help files. Is the text property the displayed label? Or is this text property the same as value but converted to character? Does it get displayed on the form when changed?

    thx,
    Zod

Similar Threads

  1. Bad Object Handle
    By Brandon Burtnik in forum Alpha Five Version 5
    Replies: 2
    Last Post: 08-18-2005, 01:56 PM
  2. Bad Object Handle
    By Mike Vance in forum Alpha Five Version 6
    Replies: 29
    Last Post: 07-06-2005, 07:12 AM
  3. BAD OBJECT HANDLE
    By Barry Shadduck in forum Alpha Five Version 5
    Replies: 14
    Last Post: 08-19-2003, 01:20 PM
  4. bad object handle
    By EYoo in forum Alpha Five Version 4
    Replies: 2
    Last Post: 05-30-2003, 03:04 PM
  5. bad object handle
    By Madelene Ferguson Allen in forum Alpha Five Version 1
    Replies: 2
    Last Post: 07-26-2000, 06:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •