Доступно и просто о работе в офисных пакетах
Автор ForumOOo (бот), 3 февраля 2016, 16:25
0 Пользователи и 1 гость просматривают эту тему.
Navigation from one form to anotherA form is to be opened when a particular event occurs.In the form control properties, on the line "Additional information" (tag), enter the name of the form.Further information can also be entered here, and subsequently separated out by using theSplit() function.SUB From_form_to_form(oEvent AS OBJECT)DIM stTag AS StringstTag = oEvent.Source.Model.TagaForm() = Split(stTag, ",")The array is declared and filled with the form names, first the form to be opened and secondly thecurrent form, which will be closed after the other has been opened.ThisDatabaseDocument.FormDocuments.getByName( Trim(aForm(0)) ).openThisDatabaseDocument.FormDocuments.getByName( Trim(aForm(1)) ).closeEND SUBIf instead, the other form is only to be opened when the current one is closed, for example where amain form exists and all other forms are controlled from it using buttons, the following macroshould be bound to the form with Tools > Customize > Events > Document closed:SUB Mainform_openThisDatabaseDocument.FormDocuments.getByName( "Mainform" ).openEND SUBIf the form documents are sorted within the ODB file into directories, the macro for changing theform needs to be more extensive:SUB From_form_to_form_with_folders(oEvent AS OBJECT)REM The form to be opened is given first.REM If a form is in a folder, use "/" to define the relationshipREM so that the subfolder can be found.DIM stTag AS STRINGstTag = oEvent.Source.Model.Tag 'Tag is entered in the additionalinformationaForms() = Split(stTag, ",") 'Here the form name for the new form comesfirst, then the one for the old formaForms1() = Split(aForms(0),"/")aForms2() = Split(aForms(1),"/")IF UBound(aForms1()) = 0 THENThisDatabaseDocument.FormDocuments.getByName( Trim(aForms1(0)) ).openELSEThisDatabaseDocument.FormDocuments.getByName(Trim(aForms1(0)) ).getByName( Trim(aForms1(1)) ).openEND IFImproving usability 21IF UBound(aForms2()) = 0 THENThisDatabaseDocument.FormDocuments.getByName( Trim(aForms2(0)) ).closeELSEThisDatabaseDocument.FormDocuments.getByName(Trim(aForms2(0)) ).getByName( Trim(aForms2(1)) ).closeEND IFEND SUBForm documents that lie in a directory are entered into the Additional Information field asdirectory/form. This must be converted to:...getByName("Directory").getByName("Form").