I have a simple search form using a filter table, an adaptation of an example I found here. My problem is that when the form is closed, the last parameter stored in the filter remains. Then on starting the form again the search is automatically run based on that old entry. I wrote a macro to clear the filter table at startup. It works fine when run as tools->macros->organize macros but not on opening the form. I assigned it on Form Properties-Events-When Loading. I later tried assigning it using tools-customize-Events and assigned it to the open document event.
Code: Select all
REM Clear old entry from Filter table at startup
Sub Clear_Filter_Table
REM make sure you're connected to the database
if IsNull(ThisComponent.CurrentController.ActiveConnection) then
ThisComponent.CurrentController.connect
endif
Dim oStatement As Object
oStatement = ThisComponent.CurrentController.ActiveConnection.createStatement()
oStatement.execute("update ""Filter"" set ""F1"" = NULL where ""FilterID"" = 0;")
End Sub
I saved the macro in the odt file but that didn't help. I then found other examples and variations for the connection that didn't work. Screwed my notes up or I'd list them.
I will greatly appreciate any help. I'm now quitting to watch the Florida Auburn game. I'm a Gator.
Thank you.