Base Macro - How to check if a form is open

Hi,

Win10 LO7.1.4 HSQL2.51

Looked for some time for an equivalent of access isopen, how is that accompllshed in Basic to decide to which form to return if there are choices,
Thanks for pointers.

1 Like

@Ratslinger
aaah, was wondering about the completion flag, thank you for the code

Hello,

Spent a bit of time looking for an easy “isopen” method (including a brief look in Access2Base) but found none. Based upon a post I saw some time ago (switching open Writer documents) I thought to use a similar method for getting open frames in Base. Here is code:

Sub checkOpenForms
    oFrames = ThisDatabaseDocument.getCurrentController().getFrame().getFrames()
    For i = 0 to oFrames.Count  - 1
        oForm = oFrames.getByIndex(i)
        sTitle = oForm.Title
        sName1 = Mid(sTitle, Instr(sTitle,":") + 2)
        sName = left(sName1, Instr(sName1," - Libre"))
        print sName
    next i
End sub

This cycles through all open Base frames and strips the form name from the title.

As an aside, there is a way to accept answers here. Three dots bottom of an answer (show more) and there you find a selection for “Solution”

1 Like

A hint: the markup for code here on Discourse is to use ``` (three backticks) around the code (on separate lines). It even accepts a string immediately following the backticks as a “language” - but AFAICT the “language” does not affect the result.

sub test
end sub
1 Like

@mikekaganski,

Thank you. Had seen this before and not certain why I did not use - applied now. Better with backticks.