Page 1 of 1

[Solved] New record already active when opening a form

Posted: Sun Jan 12, 2014 4:41 pm
by pinco pallo
Hello, how do you open a form with the new record already active? If possible without macros, thank you.

Re: New record already active when opening a form

Posted: Sun Jan 12, 2014 5:21 pm
by Villeroy

Re: New record already active when opening a form

Posted: Sun Jan 12, 2014 6:11 pm
by pinco pallo
I followed your topic, but so I no longer see the other records. Or am I wrong? See please attached example with two forms. Thanks.

Re: New record already active when opening a form

Posted: Sun Jan 12, 2014 6:46 pm
by DACM
'Add data only' does restrict the Form to records added since opening the Form. To see all records while opening the Form to a new record will require a macro:
  • Code: Select all

    Sub InitializeForm 'Form > Event > When Loading 
       Dim oForm As Object 
       oForm = ThisComponent.DrawPage.Forms.GetByIndex(0) '.GetByName("MainForm")
       IF oForm.isloaded = false THEN Wait 100 'allows faster CPUs to continue while waiting for slower ones 
    '  oForm.Last 
    '  oForm.First 'this line along with .Last above leaves the total number of records in nav bar 
       oForm.MoveToInsertRow 
    End Sub 

Re: New record already active when opening a form

Posted: Sun Jan 12, 2014 6:52 pm
by Villeroy
DACM wrote:'Add data only' does restrict the Form to records added since opening the Form. To see all records while opening the Form to a new record will require a macro:
Or a single click on some form button, toolbar button or Ctrl+PgDown
And of course you can have one form to enter new records, another one to scroll, filter sort in the same table.
Macros are evil.

Re: New record already active when opening a form

Posted: Tue Jan 14, 2014 5:50 pm
by pinco pallo
I also prefer no macro, but if you need ...
Thanks to all.