locked
Error in AddObject RRS feed

  • Question

  • Hi all,

    I use vfp9 sp2 and winxp.

    When I do "do form email" I get an error with this error message:

    Error number: 1881
    Error message: Error with CHECK2 - Value : Data Type mismatch.
    Line of code with error: .column9.AddObject("check2","checkbox")
    Program with error: EMAIL.GRID1.INIT

    The strange thing is that I only get this error when I click the menu for the email form from the boarding form. If I am in any other form when I click the menu for the email form I don't get this error. Neither do I get it if I click the menu for the email form when I enter the application.

    I have studied the boarding form and I fail to see why it would create this error.

    The help for error number 1881 advises me to open the email form as a table. I have done that, but don't see anything that should be fixed.

    The email form is called in the menu with: do form email.

    Any help would be greatly appreciated.

    Regards,

    Jan Nordgreen

    Sunday, November 6, 2011 8:51 AM

Answers

  • Well, the issue section of your error is quite clear:

    The field bound to the checkbox has the wrong type. So what is bound to column9. Debug the init code and see what is the controlsource of column9 before you add the checkbox to it.

    Bye, Olaf.

    • Marked as answer by damezumari Sunday, November 6, 2011 11:33 AM
    Sunday, November 6, 2011 9:02 AM

All replies

  • Well, the issue section of your error is quite clear:

    The field bound to the checkbox has the wrong type. So what is bound to column9. Debug the init code and see what is the controlsource of column9 before you add the checkbox to it.

    Bye, Olaf.

    • Marked as answer by damezumari Sunday, November 6, 2011 11:33 AM
    Sunday, November 6, 2011 9:02 AM
  • Olaf thank you for your reply!

    As a matter of fact, the grid did not have a stated record source in the email form. That was OK if I did not call the form email from the form boarding. Now I gave it a recordsource in the grid's init procedure making the datatype correct in the 9th field. Now it works OK.

    I was sloppy not to assign a record source in the first place, but why it crashed when the form was called from boarding and not from any of the other forms remains to me a mystery.

    Regards,

    Jan Nordgreen

     


    • Edited by damezumari Sunday, November 6, 2011 11:36 AM
    Sunday, November 6, 2011 11:33 AM
  • It's the behaviour of a grid. If you don't assign a recordsource to it, it simply takes the current workarea as it's recordsource.

    For example:

    Use ? && choose any table
     _screen.AddObject("grid1","grid")
    _screen.grid1.Visible=.t.
    ? _Screen.grid1.recordsource

    So previously, calling that form from somewhere else you just had luck there was an acceptable type on the 9th column.

    Bye, Olaf.




    Sunday, November 6, 2011 11:51 AM
  • Great! That explains it.

    Regards,

    Jan

    Sunday, November 6, 2011 12:57 PM