Database registration gets lost

Discuss the database features
Post Reply
DTC57
Posts: 4
Joined: Tue Oct 17, 2017 3:50 pm

Database registration gets lost

Post by DTC57 »

I have a Base database linked to a Calc spreadsheet (pivot table). This works fine on one computer (Windows 10), but on another (Windows 7), the database registration settings get lost. What could the problem be?

Many thanks, David
OpenOffice 4.1.3 on Windows 10
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Database registration gets lost

Post by Villeroy »

[Spreadsheet] --> [Base document] --> [other documents]

The connection from a spreadsheet to Base is stored relatively in the Base document. When you copy both files to the other system so their relative path to each other remains the same, everything works fine. In the database menu:Edit>Database>Connection... lets you change the path. The path is also displayed in the status bar of the database document.

The second connection from Base to any other document (the registration) is stored absolutely in the user's profile folder. You can change it via menu:Tools>Options>Base>Databases
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
DTC57
Posts: 4
Joined: Tue Oct 17, 2017 3:50 pm

Re: Database registration gets lost

Post by DTC57 »

The relative paths are indeed the same. I copide the two files together from the Windows 10 machine to the Windows 7 one. The problem is a different one. When I add the database under the registered paths (options), the setting seems to get lost, so that the spreadsheet does not find the database file, since the registration setting gets lost. Any idea what could be the problem on the Windows 7 machine?
OpenOffice 4.1.3 on Windows 10
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Database registration gets lost

Post by Villeroy »

If you want the same templates, macros, auto text, dictionaries, database registrations and overall settings on both machines, you should copy the user profile folder %APPDATA%\OpenOffice\4\user
Before doing that, make a backup of the old user profile on the target machine.
However, it possible that the database paths of the database registrations are different on two Windows machines. They could be the same for the same user name.
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
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Database registration gets lost

Post by Villeroy »

Store the database document in a trusted directory according to Tools>Options>Security>[Macro Security]
Store the macro in the database document.
Adjust constant cRegName to your needs.
Call Tools>Customize>Events while your database is the active document.
Save in: <your database document>
Assign the database document's "Open Document" event to the macro.

Code: Select all

Sub setupDBRegistration()

Const cRegName = "My Database"

sDocURL = ThisDatabaseDocument.getURL()
oRegSrv = createUnoService("com.sun.star.sdb.DatabaseContext")
oRegSrv.registerDatabaseLocation(cRegName, sDocURL)
End Sub
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
Post Reply