Opening a form from a macro no record data visiable

I am opening a form from a button click on a different form. The first time i click the button the form opens with all of the fields blank. Then I can click on the button again and the form opens with all the fields populated. When opening the form from the GUI the fields are always populated with information.

Missing some information:
There is a form opened inside Base?
You want to open another form inside Base, starting with a button from the first form?
How do you manage to open the second form? By Macro?

yes, by Macro.

Perhaps the
Wait
issue🤔
Check
Issue with interacting Base forms

Or: There has been set a filter: Unable to pass filter string to form and no row of the opened form will be shown with that special filter value.

every thing is in base and by Macro

oForm = ThisDatabaseDocument.FormDocuments.getByName("ResorceF").open()

[…]
:grey_question:

this is how i am opening the form. Are there additional parameters that can go with this method?

No. Just asking on top of @RobertG’s filter conjecture.
Because to me here there is not any “delay” (need of Wait) issue.
 
Remarks

  • DB = @Villeroy’s Teams_Finance_3.odb
  • No need of the TextBox value. It is for a possible filter setting.
Option Explicit
Sub AbrirResourceF(Evt As Object)
	'GlobalScope.BasicLibraries.LoadLibrary("MRILib")
	Dim DocToOpen As Object
	On Error GoTo Erro
	DocToOpen = ThisDatabaseDocument.FormDocuments.getByName("ResourceF").open
	Exit Sub
	Erro: MsgBox "ERRO " & Err & Chr(10) & "na linha " & Erl
End Sub

CallerForm
OpenedForm

what is happening is when the sub routine is in the My Macros section the first time it is called the form fields are blank, then acts normal if called a second time. you can keep opening it and it acts as expected. If I open another from from a macro it does the same thing, opening the form with the fields blank on the first try. Putting the sub routine in the database.odb section and the forms open as expected with the fields populated.

I would save macros only directly in the Base file.

  1. You could move the file to other systems without any problem.
  2. When loosing the macros in “My Macros” you won’t loose the macros (Have blank “MyMacros” very often when changing between different versions from LO here).
  3. Connection between macro and database will work well.

the problem occurred again even in the .odb container. Adding a wait of 200 is working for now, even if the subroutine is in the My Macro container.