Base Form reset behaviour

LO, Ubuntu 18.04 with all updates.


I have a Base form that can be called to show from more than one place. Given that I haven’t (yet) found how to show the form modally (I know it can be done with a dialog but I found it very painful!) I came up with the idea of dumping the name of the calling form into a hidden textbox on the active form so I can easily return to the parent - steps are:

  • load new form
  • push name of currentform into
  • hide current form
  • …process…
  • make form named in txtDaddy visible
  • unload current form

sub StudentClassOpenFromDashboard(oEvent as object)
'###	Disable "Show Details" button on Dashboard then open details form'
'###	Called from fm_Dashboard'

Dim oForm as object
Dim oNewForm as object
Dim ctl as object
'###	Disable button, open class form then hide dashboard'
	ctl = oEvent.source.model
	oForm = ctl.parent
	oForm.getByName("btnCurrent").enabled = False
	oNewForm =openForm( "frm_StudentClass")
	oNewForm.Controls("txtDaddy").value = "frm_Dashboard"

	Application.forms("frm_Dashboard").visible = false

end sub

And to return to the calling form…

sub DB_CloseForm(pEvent as object)
Dim sName, sParent  as string
Dim oFrm as object

'###	closes form  and shows calling form.'
'###	Calling form name is stored in hidden "txtDaddy" field on form we are closing.'
oFrm = pEvent.source.model.parent
select case
	case "frmMainStuds"
		sName = "frm_StudMain"
	case "frmMainStudClass"
		sName = "frm_StudentClass"
	case "NewClassForm"
		sName = "frm_StudentClassNew"
end select

'###	Show parent form before closing to avoid having a blank screen whilst it works!'
sParent = oFrm.getByName("txtDaddy").text
Application.Forms(sParent).visible = true

end sub

This seems to work well. HOWEVER…

I was debugging something and needed to show the contents of txtDaddy so made it visible. Then, I noticed that when the ‘Cancel Changes’ button of the form is pressed, txtDaddy was cleared along with all the bound controls - even though I have bound it to a field in the underlying table. Making it hidden excludes it from the reset process.

This in itself is not a problem, as the textbox is not normally visible and then, it seems, the value is left intact.

My question is can this behaviour be relied upon for the future or is it an oversight? Should I take the precaution of dumping my textbox into a subform that will not be affected by the cancel updates process?

PS Please forgive the sloppy switching of code between basic & Access2Base, I’m still learning how this works!


Couple of things. You state a hidden textbox. Did you know there is a Hidden control which is great for this type of situation?

While editing the form, open Form Navigator, right click on a form and select New and there you will see Hidden Control. This is ideal for what you are using.

Now for the textbox resetting. If it is not assigned to a table field, don’t see where reset would affect it. But you should know that you can have multiple main internal forms and not just sub forms. You can place these controls (including the Hidden one just noted) on their own form and keep them safe from other items.

BTW here is accessing the text data (‘Additional information’ property in control):

oHiddenControl = oForm.getByName("CONTROL_NAME")
sData = oHiddenControl.Tag

There is also a Value property.


Have done this all without Access2Base and to anther level. If interested see answer/sample(s) in this post → How would you return to a form after navigating to different form?

Edit #2;

Sorry should be clearer. Value is actually HiddenValue:

sData = oHiddenControl.HiddenValue

@Ratslinger Hello!

I had seen the ‘Hidden Control’ and made a mental note to investigate it at some point… Ho Hum.
I am also interested why a control that isn’t tied to a field should reset but, as I read more and see that a form is, effectively, a resultset then I can understand that any control tied to it may be cleared. Still a question around whether it should still be cleared if it is hidden…

Anyway, your info and links are very useful and interesting. Thank you.

PS Still struggling with the LO basic vs Access2Base!


I do hide entire sections of controls in forms but never had the occasion to notice it is not cleared as you state. It is my opinion it should be cleared regardless if visible or not. Can see both sides to an unbound control. Do find the ‘Hidden Control’ useful at times.

When I departed from Access years ago, after a brief look at Access2Base, decided to dig into the Uno API instead. Now I am glad it was the direction taken as it is helpful throughout LO and not just Base. Unfortunately the learning curve is step and documentation is all over the place. Does take time and committed effort. Don’t see basic as an issue, it is Uno.