Is it possible to load a form from other, for example having a table grid into and we want to click on some wow and other form get loaded ?
how to do it ?
thx in advance
Load a form from other ?
Load a form from other ?
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
Re: Load a form from other ?
This is what subforms do. If there is a problem with screen space, you can scroll to the subform by hyperlink or you can write a macro to open another form document and pass the current record ID to the contained form.
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
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Load a form from other ?
Villeroy, i use subforms, usually to show filtered data conforming the main form. But i wanted, for example, to click on some row on the table grid into the sub-form, and by the way open 'specialized' form i have designed just on that db record.
Can you please show an example to do it ?
thx in advance
Can you please show an example to do it ?
thx in advance
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
Re: Load a form from other ?
Write a program. You can not expect that someone does that for you over and over again.
We have a whole subforum only for database expamples. With a little bit of searching you could have found this: viewtopic.php?f=100&t=36124
We have a whole subforum only for database expamples. With a little bit of searching you could have found this: viewtopic.php?f=100&t=36124
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
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Load a form from other ?
maybe i have expressed it bad, maybe the better way is to have some button with a macro doing some query and loading the results in the current form. Simpliest to open other forms i think. Using filters that can be easily done, but, when we want to open other form, is with the intention to show the clicked element, and that's my problem, i dont know how to do that...
help
help
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
Re: Load a form from other ?
Assign this code to your command button. Delete second line if you don't want to close the first form
Or a more comprehensive/universal solution is below. To use this, assign the command button's 'Mouse button released' event to it and if you want to close the calling form add its name to the 'Additional information' property of the button.
Code: Select all
sub FormButton
ThisDatabaseDocument.FormDocuments.GetByName("NewForm").open
ThisDatabaseDocument.FormDocuments.GetByName("OldForm").close
end sub
Code: Select all
sub OpenFormCloseForm_Button_Click( oev as variant )
'reads sOpenFormName & sCloseFormName separated by a comma from tag of calling button
Dim XX, sOpenFormName, sCloseFormName as string
Dim N1,N2 as integer
XX=oev.Source.Model.Tag
N1=len(XX)
N2=instr(XX,",")
If N2<>0 then
sOpenFormName = left(XX,N2-1)
sCloseFormName = right(XX,N1-N2)
else
sOpenFormName = XX
sCloseFormName = ""
endif
OpenForm( getFormsTC, getConnectionTC, sOpenFormName )
If sCloseFormName<>"" then ThisDatabaseDocument.FormDocuments.GetByName(sCloseFormName).close
end sub
function OpenForm( formContainer as variant, oConnection as variant, sFormName as string) as variant
Dim aProp(1) As New com.sun.star.beans.PropertyValue
aProp(0).Name = "ActiveConnection"
aProp(0).Value = oConnection
aProp(1).Name = "OpenMode"
aProp(1).Value = "open"
OpenForm = formContainer.loadComponentFromURL(sFormName,"_blank",0,aProp())
end function
function getFormsTC() as variant
getFormsTC = thisComponent.Parent.getFormDocuments
end function
function getConnectionTC() as variant
getConnectionTC = thisComponent.Drawpage.Forms(0).ActiveConnection
end function
OpenOffice 4.1.12 on Windows 10