Ask Your Question
0

How to autostart a Form by default at ODB opening ?

asked 2016-09-07 20:01:14 +0100

kirsch gravatar image

I would like to have the "FormNew" to open automaticly when Opening the data base "LibO_RKM_start_FormNew.odb. Is there a macro to do that on the attached base example ?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2016-09-07 21:30:03 +0100

Ratslinger gravatar image

updated 2016-09-07 21:32:24 +0100

This is basically the same routine presented in this past post:

SUB OpeningForm
  Dim ObjTypeWhat
  Dim ObjName As String
  ObjName = "FormNew"
  ObjTypeWhat = com.sun.star.sdb.application.DatabaseObject.FORM
  If ThisDatabaseDocument.FormDocuments.hasbyname(ObjName) Then 'Check the form exists'
     ThisDataBaseDocument.CurrentController.Connect() 'If the form exists connect to the database'
     ThisDatabaseDocument.CurrentController.loadComponent(ObjTypeWhat, ObjName, FALSE) 'Open the form'
  Else
      MsgBox "Error! Wrong form name used. " & ObjName
  End if
End Sub

From menu Tools->Customize attach the macro to Open Document Event of .odb then Save, close the .odb and re-open. Form should start automatically.

edit flag offensive delete link more
0

answered 2018-02-28 18:44:48 +0100

Dear Ratslinger,

Thank you for you advice.

Under Tools-.Customize I cannot find "Open Document". There is "Open Database Object". I am not sure how it would attache.

edit flag offensive delete link more

Comments

@dominic.joannou

First, please use comment for this type of response. Answers should be used to respond to original question.

You seem to be looking under the incorrect Tab in Tools->Customize. You will find it under the Event tab.

Ratslinger gravatar imageRatslinger ( 2018-02-28 19:12:36 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-09-07 20:01:14 +0100

Seen: 1,529 times

Last updated: Feb 28 '18