Base how to delete an odb object via macro

WIN10, LO 6.4.6.2 HSQL2.51

Hi,

I can check whether for example a form exist

ObjTypeWhat = com.sun.star.sdb.application.DatabaseObject.FORM
If ThisDatabaseDocument.FormDocuments.hasbyname(ObjName) 
	Msgbox "the form exists, can run macro instead"		
	else
	Call Menu_Main........

and based on is existence, run a macro or open a menuform.
One thing I can not figure out, can I delete the form after from the same calling macro ?

Thanks

Hello,

Once you have determined the form exists, you can delete it with:

ThisDatabaseDocument.FormDocuments.removeByName("BASE_FORM_NAME")

This will require you to save the Base file just the same as when you manually add, delete or modify items in Base. You can also do this with an uno Save line in your macro.

@Ratslinger - you shouldn’t be working on Sundays ! -joke aside many, many thanks, that was the final missing bit on how to maintain production versions via a generic installer.