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

Creating and using forms
Post Reply
mohanvarier
Posts: 4
Joined: Tue Sep 22, 2020 3:56 pm

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

Post 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
Last edited by mohanvarier on Mon Sep 28, 2020 7:40 am, edited 1 time in total.
OpenOffice 4.1.7 Windows 7 Ultimate
F3K Total
Volunteer
Posts: 1038
Joined: Fri Dec 16, 2011 8:20 pm

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

Post 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
Attachments
Test_update_insert_row.odb
(12.94 KiB) Downloaded 252 times
  • MMove 1.0.6
  • Extension for easy, exact positioning of shapes, pictures, controls, frames ...
  • my current system
  • Windows 10 AOO, LOLinux Mint AOO, LO
mohanvarier
Posts: 4
Joined: Tue Sep 22, 2020 3:56 pm

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

Post 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
OpenOffice 4.1.7 Windows 7 Ultimate
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

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

Post by Villeroy »

upadateinteger is not a valid method name
updateinteger is
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
F3K Total
Volunteer
Posts: 1038
Joined: Fri Dec 16, 2011 8:20 pm

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

Post by F3K Total »

try

Code: Select all

updateint()
  • MMove 1.0.6
  • Extension for easy, exact positioning of shapes, pictures, controls, frames ...
  • my current system
  • Windows 10 AOO, LOLinux Mint AOO, LO
Post Reply