I have a MySQL database running through base.
I have a main form with buttons that use the macro below to load other forms.
Code: Select all
sub load_support
dim oCurrentController
'Variables for document what will be opened
dim sNewfileFormName ' This is the name how it is in the database
dim oNewformtoSee ' Object for the new form what will beopend
sNewfileFormName="customersupport" 'is a writer form it must be in this database
'ThisDatabaseDocument 'ThisDatabaseDocument is a new constant in OOO3.0
oCurrentController=ThisDatabaseDocument.CurrentController
if ThisDatabaseDocument.FormDocuments.hasbyname(sNewfileFormName) then
' the form exist and can maybe opend
oNewformtoSee=oCurrentController.loadComponent( com.sun.star.sdb.application.DatabaseObject.FORM,sNewfileFormName,FALSE) ' or TRUE for editing the documentwait 10
else
msgbox "The does not exist and cannot be opend"
end
end if
End Sub
Each other form has a button to return to the main menu which uses the same macro as above to load the main menu, is their a way to get it to close the form that is currently loaded before returning to the main form?
Thanks in advance!
Title Edited. A descriptive title for posts helps others who are searching for solutions and increases the chances of a reply. (TheGurkha, Moderator)