Skip to content

printform1 selectkey problem

Forums Forums SIMPOL Programming printform1 selectkey problem

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #206
    Jean Vallee
    Participant

    Trying to use printform1.selectkey but am getting an error 16 – wrong type. It only has 4 parameters but I’ve had no success trying to determine which one it’s complaining about. dring datasrc datasrc =@ app.datasources integer e; e = 0 printform1 pf pf =@ openprintform1(“bldgform.sxp”, defpagewidth = 215900, defpageheight = 279400, defnumberformat = “999999.00”, defdateformat = “mm/0d/yyyy”, deftimeformat = “hh:mm”, datelocale = ds, numericlocale = ns, datasources = datasrc, error = e) anyvalue pn pn = me!PrmtTnum.control.text type(db1index)pfi pfi =@ setidx_PrmtTNum(appw) app.bFound = .false // no errors to here // this statement raises the error 16 pf =@ pf.selectkey(pn, pfi, found=app.bFound, e) Both pn and pfi are valid objects of the correct type so what else could it be? Jean Vallee

    #2212
    Michael
    Keymaster

    On 05/04/2013 18:45, JV wrote:
    > Trying to use printform1.selectkey but am getting an error 16 – wrong type.
    >
    > It only has 4 parameters but I've had no success trying to determine
    > which one it's complaining about.
    >
    > dring datasrc
    > datasrc =@ app.datasources
    > integer e; e = 0
    >
    > printform1 pf
    >
    > pf =@ openprintform1("bldgform.sxp", defpagewidth = 215900,
    > defpageheight = 279400, defnumberformat = "999999.00",
    > defdateformat = "mm/0d/yyyy", deftimeformat = "hh:mm", datelocale = ds,
    > numericlocale = ns, datasources = datasrc, error = e)
    >
    > anyvalue pn
    > pn = me!PrmtTnum.control.text
    >
    > type(db1index)pfi
    > pfi =@ setidx_PrmtTNum(appw)
    >
    > app.bFound = .false
    > // no errors to here
    >
    > // this statement raises the error 16
    > pf =@ pf.selectkey(pn, pfi, found=app.bFound, e)

    You are attempting to assign the dataform1record object to a printform1 variable. This was probably not what you intended.

    > Both pn and pfi are valid objects of the correct type so what else could
    > it be?

    It is the return value where the type error is occurring.

    Ciao, Neil

    #2219
    Jean Vallee
    Participant

    On 4/8/2013 2:16 PM, Neil Robinson wrote:
    > On 05/04/2013 18:45, JV wrote:
    >> Trying to use printform1.selectkey but am getting an error 16 – wrong type.
    >>
    >> It only has 4 parameters but I've had no success trying to determine
    >> which one it's complaining about.
    >>
    >> dring datasrc
    >> datasrc =@ app.datasources
    >> integer e; e = 0
    >>
    >> printform1 pf
    >>
    >> pf =@ openprintform1("bldgform.sxp", defpagewidth = 215900,
    >> defpageheight = 279400, defnumberformat = "999999.00",
    >> defdateformat = "mm/0d/yyyy", deftimeformat = "hh:mm", datelocale = ds,
    >> numericlocale = ns, datasources = datasrc, error = e)
    >>
    >> anyvalue pn
    >> pn = me!PrmtTnum.control.text
    >>
    >> type(db1index)pfi
    >> pfi =@ setidx_PrmtTNum(appw)
    >>
    >> app.bFound = .false
    >> // no errors to here
    >>
    >> // this statement raises the error 16
    >> pf =@ pf.selectkey(pn, pfi, found=app.bFound, e)
    >
    > You are attempting to assign the dataform1record object to a printform1 variable. This was probably not what you intended.
    >
    >> Both pn and pfi are valid objects of the correct type so what else could
    >> it be?
    >
    > It is the return value where the type error is occurring.
    >
    > Ciao, Neil
    >
    Yes it was. I want the printform to select the record displayed in the
    dataform1 and print it.
    If I cannot assign the value of a dataform1 object to a printform1
    variable via an anyvalue type variable, what can I use instead?

    #2220
    Michael
    Keymaster

    On 08/04/2013 22:29, JV wrote:
    > On 4/8/2013 2:16 PM, Neil Robinson wrote:
    >> On 05/04/2013 18:45, JV wrote:
    >>> Trying to use printform1.selectkey but am getting an error 16 – wrong type.
    >>>
    >>> It only has 4 parameters but I've had no success trying to determine
    >>> which one it's complaining about.
    >>>
    >>> dring datasrc
    >>> datasrc =@ app.datasources
    >>> integer e; e = 0
    >>>
    >>> printform1 pf
    >>>
    >>> pf =@ openprintform1("bldgform.sxp", defpagewidth = 215900,
    >>> defpageheight = 279400, defnumberformat = "999999.00",
    >>> defdateformat = "mm/0d/yyyy", deftimeformat = "hh:mm", datelocale = ds,
    >>> numericlocale = ns, datasources = datasrc, error = e)
    >>>
    >>> anyvalue pn
    >>> pn = me!PrmtTnum.control.text
    >>>
    >>> type(db1index)pfi
    >>> pfi =@ setidx_PrmtTNum(appw)
    >>>
    >>> app.bFound = .false
    >>> // no errors to here
    >>>
    >>> // this statement raises the error 16
    >>> pf =@ pf.selectkey(pn, pfi, found=app.bFound, e)
    >>
    >> You are attempting to assign the dataform1record object to a printform1 variable. This was probably not what you intended.
    >>
    >>> Both pn and pfi are valid objects of the correct type so what else could
    >>> it be?
    >>
    >> It is the return value where the type error is occurring.
    >>
    >> Ciao, Neil
    >>
    > Yes it was. I want the printform to select the record displayed in the
    > dataform1 and print it.
    > If I cannot assign the value of a dataform1 object to a printform1
    > variable via an anyvalue type variable, what can I use instead?
    >

    That isn't a problem, but you are going about it in a very roundabout way. I would try this:

    pf.setmasterrecord(df.masterrecord.record, error=e)

    Where pf is the printform1 that you opened and df is the dataform1 that you wish to use the record from. You can have more than
    one form sharing the same record object concurrently. Once you have assigned it, call pf.print(…).

    Ciao, Neil

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.