[Solved] New record already active when opening a form

Creating and using forms
Post Reply
pinco pallo
Posts: 89
Joined: Tue Jul 16, 2013 2:24 pm

[Solved] New record already active when opening a form

Post by pinco pallo »

Hello, how do you open a form with the new record already active? If possible without macros, thank you.
Last edited by pinco pallo on Tue Jan 14, 2014 5:51 pm, edited 1 time in total.
LiBO 6.2.8.2 on macOS 10.12.6 (Sierra)
User avatar
Villeroy
Volunteer
Posts: 31345
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: New record already active when opening a form

Post by Villeroy »

Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
pinco pallo
Posts: 89
Joined: Tue Jul 16, 2013 2:24 pm

Re: New record already active when opening a form

Post 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.
Attachments
Example.odb
(18.08 KiB) Downloaded 176 times
LiBO 6.2.8.2 on macOS 10.12.6 (Sierra)
User avatar
DACM
Volunteer
Posts: 1138
Joined: Tue Nov 03, 2009 7:24 am

Re: New record already active when opening a form

Post 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 
Attachments
Example_v2.odb
Open Form to New Record using a macro
(20.29 KiB) Downloaded 278 times
AOO 4.1.x; LO 4.2.x; Windows 7/8 64-bit
Warning: Avoid embedded databases --> Solution: Adopt a portable 'split database' folder
Soli Deo gloria
User avatar
Villeroy
Volunteer
Posts: 31345
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: New record already active when opening a form

Post 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.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
pinco pallo
Posts: 89
Joined: Tue Jul 16, 2013 2:24 pm

Re: New record already active when opening a form

Post by pinco pallo »

I also prefer no macro, but if you need ...
Thanks to all.
LiBO 6.2.8.2 on macOS 10.12.6 (Sierra)
Post Reply