Page 1 of 1

[Solved] How can assign a variable value to a form field

Posted: Fri Sep 25, 2020 3:16 am
by mohanvarier
dear all
My requirement is to assign the value of a variable to a field in a form..
For the reverse purpose we can use "getCurrentValue()" property..
But for this what property or method should be used..

Please help me

Re: How can assign a variable value to a form field

Posted: Fri Sep 25, 2020 5:05 pm
by F3K Total
Hello,
find attached a small example using the following code:

Code: Select all

Sub INSERT_UPDATE_ROW
    sNAME = Inputbox("Enter Name, e.g. James","Name","")
    dNUMBER = cdbl(Inputbox("Enter Number, e.g. 12.45","Number","")
    oMainform = Thiscomponent.drawpage.Forms.getbyName("MainForm")
    oMainform.Columns.getbyName("NAME").updatestring(sNAME)
    oMainform.Columns.getbyName("NUMBER").updatedouble(dNUMBER)
    if oMainform.isnew then oMainform.insertrow else oMainform.updaterow
End Sub
R

Re: How can assign a variable value to a form field

Posted: Sun Sep 27, 2020 4:54 pm
by mohanvarier
Sir,

Thank you for your response.

sorry, i did't mentioned my correct requirement.
my requirement is in OOb, not in Cal..

from your replay i had tried the procedure ".updatedouble(dNUMBER)" with following modification.
My variable name is "iOpnum" and it is integer.
So i tried as "oControl.upadateinteger(iOpnum)"....."oControl" is my assigned object to the said Form Field

But it gives the error as

BASIC runtime error.
Property or method not found.

please help me

Re: How can assign a variable value to a form field

Posted: Sun Sep 27, 2020 5:28 pm
by Villeroy
upadateinteger is not a valid method name
updateinteger is

Re: "[Solved]"How can assign a variable value to a form fiel

Posted: Thu Oct 01, 2020 9:33 am
by F3K Total
try

Code: Select all

updateint()