Ask Your Question

Revision history [back]

The difference is described here (see at the bottom of the page).

The difference is described here (see at the bottom of the page).

Trying to run the sample database from this FAQ (available from that related question you mentioned) works for me with 5.3.2.2 (x64) on Windows, and the macro there works as expected - so it's some problem that needs to be debugged. You could attach a sample DB which doesn't work for you.

The difference is described here (see at the bottom of the page).

Trying to run the sample database from this FAQ (available from that related question you mentioned) works for me with 5.3.2.2 (x64) on Windows, and the macro there works as expected - so it's you have some problem that needs to be debugged. You could attach a sample DB which doesn't work for you.

click to hide/show revision 4
No.4 Revision

The difference is described here (see at the bottom of the page).

Trying to run the sample database from this FAQ (available from that related question you mentioned) works for me with 5.3.2.2 (x64) on Windows, and the macro there works as expected - so you have some problem that needs to be debugged. You could attach a sample DB which doesn't work for you.


[EDIT - here is the above FAQ translated to English]

How do I open and expand a form when opening a database? (Comment ouvrir et agrandir un formulaire lors de l'ouverture d'une base de données ?)

We want to open a form automatically after opening the database. (On souhaite ouvrir automatiquement un formulaire après l'ouverture de la base.)

Base allows to realize this via a macro: (Base permet de réaliser cela via une macro :)

option explicit

global LibOForm as object

Sub LibOFormOpen 
     ThisDatabaseDocument.CurrentController.connect("","") 
     LibOForm = ThisDatabaseDocument.FormDocuments.getByName("Instruments").open
End Sub

Use the Tools ▸ Customize ▸ [Tab] Events command to associate this macro with the Open Document event. (Utiliser la commande Outils ▸ Personnaliser ▸ [onglet] Événements pour associer cette macro à l'événément Ouvrir le document.)

Note: (Nota :)

The .open method returns the form object (in the LibOForm variable for this example). This technique will make it possible to manipulate (hide, display, etc.) the form by program via the variable that "represents" it, during the lifetime of the latter (the variable may be global). (La méthode .open permet de renvoyer l'objet formulaire (dans la variable LibOForm pour cet exemple). Cette technique permettra de manipuler (masquer, afficher, etc.) le formulaire par programme via la variable qui le "représente", durant la durée de vie de cette dernière (la variable peut être globale).)

Instruments is the name of the form opened in the attached sample database. (Instruments est le nom du formulaire ouvert dans la base exemple jointe.)

The following variant (Windows) adds the form enlargement after opening: (La variante ci-dessous (Windows) ajoute l'agrandissement du formulaire après l'ouverture :)

option explicit

global LibOForm as object

Sub LibOFormOpen 
     ThisDatabaseDocument.CurrentController.connect("","") 
     LibOForm = ThisDatabaseDocument.FormDocuments.getByName("Instruments").open 
     LibOForm.currentController.frame.ContainerWindow.IsMaximized = true
End Sub

Download a sample database (Télécharger une base exemple)

click to hide/show revision 5
No.5 Revision

The difference is described here (see at the bottom of the page).

[EDIT] In this case:

  • Use ThisDatabaseDocument when you have an embedded database.
  • Replace it with ThisComponent when you are connecting to a (non-embedded) database, e.g. MariaDB.

Trying to run the sample database from this FAQ (available from that related question you mentioned) works for me with 5.3.2.2 (x64) on Windows, and the macro there works as expected - so you have some problem that needs to be debugged. You could attach a sample DB which doesn't work for you.


you. [EDIT - here is the above FAQ translated to English]

How do I open and expand a form when opening a database? (Comment ouvrir et agrandir un formulaire lors de l'ouverture d'une base de données ?)

We want to open a form automatically after opening the database. (On souhaite ouvrir automatiquement un formulaire après l'ouverture de la base.)

Base allows to realize this via a macro: (Base permet de réaliser cela via une macro :)

option explicit

global LibOForm as object

Sub LibOFormOpen 
     ThisDatabaseDocument.CurrentController.connect("","") 
     LibOForm = ThisDatabaseDocument.FormDocuments.getByName("Instruments").open
End Sub

Use the Tools ▸ Customize ▸ [Tab] Events command to associate this macro with the Open Document event. (Utiliser la commande Outils ▸ Personnaliser ▸ [onglet] Événements pour associer cette macro à l'événément Ouvrir le document.)

Note: (Nota :)

The .open method returns the form object (in the LibOForm variable for this example). This technique will make it possible to manipulate (hide, display, etc.) the form by program via the variable that "represents" it, during the lifetime of the latter (the variable may be global). (La méthode .open permet de renvoyer l'objet formulaire (dans la variable LibOForm pour cet exemple). Cette technique permettra de manipuler (masquer, afficher, etc.) le formulaire par programme via la variable qui le "représente", durant la durée de vie de cette dernière (la variable peut être globale).)

Instruments is the name of the form opened in the attached sample database. (Instruments est le nom du formulaire ouvert dans la base exemple jointe.)

The following variant (Windows) adds the form enlargement after opening: (La variante ci-dessous (Windows) ajoute l'agrandissement du formulaire après l'ouverture :)

option explicit

global LibOForm as object

Sub LibOFormOpen 
     ThisDatabaseDocument.CurrentController.connect("","") 
     LibOForm = ThisDatabaseDocument.FormDocuments.getByName("Instruments").open 
     LibOForm.currentController.frame.ContainerWindow.IsMaximized = true
End Sub

Download a sample database (Télécharger une base exemple)

click to hide/show revision 6
No.6 Revision

The difference is described here (see at the bottom of the page).

[EDIT] In this case:

  • Use ThisDatabaseDocument when you have an embedded database.
  • Replace it with ThisComponent when you are connecting to a (non-embedded) database, e.g. MariaDB.

Trying to run the sample database from this FAQ (available from that related question you mentioned) works for me with 5.3.2.2 (x64) on Windows, and the macro there works as expected - so you have some problem that needs to be debugged. You could attach a sample DB which doesn't work for you. [EDIT - here is the above FAQ translated to English]

How do I open and expand a form when opening a database? (Comment ouvrir et agrandir un formulaire lors de l'ouverture d'une base de données ?)

We want to open a form automatically after opening the database. (On souhaite ouvrir automatiquement un formulaire après l'ouverture de la base.)

Base allows to realize this via a macro: (Base permet de réaliser cela via une macro :)

option explicit

global LibOForm as object

Sub LibOFormOpen 
     ThisDatabaseDocument.CurrentController.connect("","") 
     LibOForm = ThisDatabaseDocument.FormDocuments.getByName("Instruments").open
End Sub

Use the Tools ▸ Customize ▸ [Tab] Events command to associate this macro with the Open Document event. (Utiliser la commande Outils ▸ Personnaliser ▸ [onglet] Événements pour associer cette macro à l'événément Ouvrir le document.)

Note: (Nota :)

The .open method returns the form object (in the LibOForm variable for this example). This technique will make it possible to manipulate (hide, display, etc.) the form by program via the variable that "represents" it, during the lifetime of the latter (the variable may be global). (La méthode .open permet de renvoyer l'objet formulaire (dans la variable LibOForm pour cet exemple). Cette technique permettra de manipuler (masquer, afficher, etc.) le formulaire par programme via la variable qui le "représente", durant la durée de vie de cette dernière (la variable peut être globale).)

Instruments is the name of the form opened in the attached sample database. (Instruments est le nom du formulaire ouvert dans la base exemple jointe.)

The following variant (Windows) adds the form enlargement after opening: (La variante ci-dessous (Windows) ajoute l'agrandissement du formulaire après l'ouverture :)

option explicit

global LibOForm as object

Sub LibOFormOpen 
     ThisDatabaseDocument.CurrentController.connect("","") 
     LibOForm = ThisDatabaseDocument.FormDocuments.getByName("Instruments").open 
     LibOForm.currentController.frame.ContainerWindow.IsMaximized = true
End Sub

Download a sample database (Télécharger une base exemple)