Difference between revisions of "MSA-Base Faq"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Can I use Microsoft Access databases (.mdb) in Base?)
(Can I read my Base database from MS Access (MSA)?)
 
(155 intermediate revisions by 15 users not shown)
Line 1: Line 1:
Common questions and answers for those migrating from MS Access to OO.o Base.
+
Common questions and answers for those migrating from [[Microsoft Access]] (MSA) to OpenOffice.org [[Base]].
  
 
This is a user community effort - add to the knowledge base if you can.
 
This is a user community effort - add to the knowledge base if you can.
  
Please however try to keep the questions and answers general. If there is an answer regarding a feature specifc version of MSA then include the version number also.
+
Please however try to keep the questions and answers general. If there is an answer regarding a feature specific version of MSA then include the version number also.
  
'''Specifically, please only update the wiki if you have an answer for the question you are adding.''' ( ''If you may need to get back shortly with the answer don't let that stop you from getting the queston in first however - just come back before long'' )  
+
'''Specifically, please only update the wiki if you have an answer for the question you are adding.''' ( ''If you may need to get back shortly with the answer don't let that stop you from getting the question in first however - just come back before long'' )  
  
 
For asking '''specific questions''' or for general help it would be appropriate to then ask on either the:
 
For asking '''specific questions''' or for general help it would be appropriate to then ask on either the:
Line 11: Line 11:
 
or on   
 
or on   
 
[http://dba.openoffice.org/servlets/ProjectMailingListList the Base users mailing list].
 
[http://dba.openoffice.org/servlets/ProjectMailingListList the Base users mailing list].
 
  
 
== Can I use Microsoft Access databases (.mdb) in Base? ==
 
== Can I use Microsoft Access databases (.mdb) in Base? ==
  
On Windows: yes. You cannot open them directly via <code>File|Open</code>, but you can access the data therein. For this, you need the [http://msdn.microsoft.com/data/ref/mdac/downloads Microsoft Data Access Components], which are available from Microsoft for free. (In Windows XP, they're already included, so you need them for older Windows versions only.)
+
On Windows: yes. You cannot open them directly via <code>File|Open</code>, but you can access the data therein. For this, you need an Open Document Base file (*.odb), which holds the connection information. For details see [[Microsoft Access]] or [[Connecting to Microsoft Access]].
 +
 
 +
You can modify the data in the tables and you can add and remove records.
 +
You can create new tables, but you cannot alter the structure of existing tables.
 +
 
 +
Queries in MS Access are shown as views in the table container. You can use the query results, but you have no access to the underlying definitions and you cannot alter them.
  
Then, go to <code>File|New|Database</code>, choose "Connect to an existing datbase", and select the "Microsoft Access" database type from the list. On the next page, you then select the .mdb file you want to access - that's it!
+
You cannot read MS Access forms or reports.
  
This will allow you to read and update the data in your Acess tables.
+
== Can I read my Base database from MS Access (MSA)? ==
 +
That depends. There's no way to to link to tables stored within a Base .odb file. But there's two types of .odb files generated by Base; those with and those without an "embedded database." So if your Base .odb file is simply linked to an external, MSA-compatible, data source, particularly those offering an "[http://www.utteraccess.com/wiki/index.php/Beginners_Guide_To_ODBC ODBC]" connection option, then MSA will ''''<u>L</u>ink to the data source by creating a linked table'''.' And you get full read/write access with the "ODBC" option. Changes made in MSA will be reflected in the data source, and therefore in Base, and vice versa.
  
You cannot read / modify or use the Access forms, queries, or reports.
+
Technically, it is possible to [http://hsqldb.org/doc/2.0/guide/openoffice-app.html#ooa_db_files_convert extract] an "embedded database" from a Base .odb file through a [http://www.oooforum.org/forum/viewtopic.phtml?p=386995#386995 manual extraction process]. This is necessary for instance to upgrade from the built-in HSQLDB 1.8 engine to the latest [http://hsqldb.org/doc/2.0/guide/deployment-chapt.html#dec_upgrade_database HSQLDB 2.x] engine in order to take advantage of newer HSQLDB features which [http://hsqldb.org/web/hsqlDevelopment.html may soon] include an "ODBC" option as necessary for MSA linking. But for now HSQLDB only provides Java-based "[http://en.wikipedia.org/wiki/Java_Database_Connectivity JDBC]" linking, which is noticeably absent from MSA's link options. So a [http://stackoverflow.com/a/5403672 third-party ODBC-to-JDBC] "bridge" or "gateway" ([http://uda.openlinksw.com/images/odbcjdbcst.gif diagram]) is currently required to link MSA to a database generated by the HSQLDB engine as bundled with OpenOffice.org.  
  
== Can I read my Base database from MS Access? ==
+
As an alternative to "bridging" it should be possible to [http://www.oooforum.org/forum/viewtopic.phtml?p=460854#460854 migrate your HSQL database] to one that offers "ODBC" connectivity. Most options are compatible with both MSA and Base including: [http://en.wikipedia.org/wiki/SQL_Server_Express SQL Server Express], [http://www.h2database.com/html/advanced.html#odbc_driver H2] ([http://www.oooforum.org/forum/viewtopic.phtml?t=97522 tutorial]), [http://sqlite.awardspace.info/syntax/sqliteodbc.htm SQLite], [http://www.postgresql.org PostgreSQL], [http://www.mysql.com/downloads/mysql/ MySQL], [http://mariadb.org/ MariaDB], [http://www.firebirdsql.org/ Firebird], MS SQL Server, Oracle, etc.  
There is no way to use the table linking mechanisim in Access to connect to a Base database.
+
  
It is possible for a Base database to update data in the Access database. At this time this will require however that the Access database be opened and locked by the Base file.
+
It is possible to use a Base .odb file to update data in a MSA database (.mdb), but only from a Windows machine. This requires the MSA database be opened and locked by the Base file.
  
Data could also be passed back to the Access database by creating a linked CSV file in the Base database. Then linking to this CSV file to a table in the Access database.
+
Data could also be passed to a MSA database by linking both MSA and Base to the same CSV file(s).
  
 
== Can I create an Access database (mdb file) with Base? ==
 
== Can I create an Access database (mdb file) with Base? ==
  
No. Base can not create a new Access database file; or new tables, queries, forms etc. within an existing mdb file.
+
No. Base cannot create a new Access database file; or new tables; or modify existing table structures/properties. Base queries, forms and reports can be added to the Base .odb file, but not to the Access .mdb file.
  
 
== Can I create a Switchboard in Base? ==
 
== Can I create a Switchboard in Base? ==
  
Base does not currently have a switchboard style form wizard. It is possible to achieve a very similar effect however using either of two techinques.
+
Base does not currently have a switchboard style form wizard. It is possible to achieve a very similar effect however using one of several techniques.
  
 
=== Opening a default form via a macro ===
 
=== Opening a default form via a macro ===
  
=== Using a stand alone form to launch the Base database ===
+
=== Use a stand alone form to launch the Base database ===
== Our Access databases uses "Workgroup Security" to control group/user permission to view/maintain data? ==
+
see [http://user.services.openoffice.org/en/forum/viewtopic.php?f=83&t=40493 Tutorial: Standalone Forms / Switchboard]
  
This question points out what is a fundamental difference between OOoBase and MSAccess . In the case of MSA (MS Access) there is one and only one database engine in use - although you may link tables in MSA to external datasource - MS Jet is still the only database engine actually used by MSA.
+
=== Base Switchboard extension ===
 +
Development started to bring switchboard feature into OOo, see the Roberto Benitez's [http://extensions.services.openoffice.org/project/SwitchBoard Base Switchboard extension].
  
In Base (OOoBase) this is not the case at all. The Base database document is simply a front end ( client application ) to a variaty of database engines. In one of these forms it embeddeds a HSQLDB database into the ODB file itself, many people simply see this as the only Base database format. That is totally mistaken. In this instance of an embedded database there is no support for multiple users and of course no support for groups therefore. However, that is only one of the ways Base can be configured.
+
== Our MS Access (MSA) databases uses "Workgroup Security" to control group/user permission to view/maintain data. Is similar access control and security possible with Base? ==
  
You are free to use Base as the front end to a HSQLDB database in server mode. HSQLDB is a very small footprint, low administraton database engine and in server mode has full support for users / groups. For larger numbers of users you could just as easily configure Base to work with MySQL, PostgrSQL, Firebird, Oracle or MS SqlServer.
+
This question highlights some fundamental differences between Base and MS Access (MSA). MSA's Jet/ACE engine is integral so even linked data-sources are accessed through Jet/ACE. This has been a problem for "[http://en.wikipedia.org/wiki/Database#Database_security database security]" because the all-in-one MDB/ACCDB file supports either "workgroup" (access control) or "security" (encryption) but not both. Specifically, the Jet-MDB database format (MSA 2003 and earlier) is [http://www.everythingaccess.com/tutorials.asp?ID=Jet-MDB-security---under-the-hood not truly "secure"] but it does offer "workgroup" (access control) functions including individual user-login and user/group permissions. This could be combined with security features of the host file system (NTFS/EFS) to formulate crude database security. On the other hand, the ACE-ACCDB file format (MSA 2007) is relatively "secure" (encryption) but forgoes the "workgroup" function in favor of a single login. So MSA's "Workgroup Security" has been little more than an [http://en.wikipedia.org/wiki/Oxymoron oxymoron]. Perhaps so much so, that Microsoft wisely decided to [http://office.microsoft.com/en-us/access-help/set-or-change-access-2003-user-level-security-in-access-2010-HA010341994.aspx depreciate "Workgroup Security" in MSA 2010] -- but continues to support the legacy function of the Jet engine for MDB files created with MSA 2003 or earlier.  
  
There is another significant difference between MSA and Base regarding this then. In MSA you would deploy one MDB (or one of its variants ) file, then have each user in the workgroup see this file and open it.
+
So database security has now formally shifted away from built-in Jet/ACE engine, such that MSA relies primarily on the security provided by linked data-source engines. Perhaps along those lines, MSA 2010 offers to '[http://office.microsoft.com/en-us/access-help/ways-to-share-an-access-database-HA010342110.aspx#BM4 split the database]' into front-end and back-end files. This can be accomplished manually by eliminating all Tables in a copy of the MDB/ACCDB file. But either way you'll need to skip the Jet/ACE back-end, using only the MDB/ACCDB front-end to link to a full-featured database engine supporting robust database security.  
  
In Base each user would have their own ODB file and each of these would be connected to the shared data server. In this way each user would have their own space for custom queries and reports - but it makes distribution of common forms, queries and reports more work.
+
This is now very similar to Base. In Base, all multi-user databases are "split." The Base 'user authentication' feature could use [http://www.oooforum.org/forum/viewtopic.phtml?p=466086#466086 some improvements], but Base is purely a front-end (client application) to a variety of database engines. The engines, themselves, provide various levels of database security: from ''none'' with dBase files or SQLite; to role based access control ([http://en.wikipedia.org/wiki/Rbac RBAC]) using the built-in HSQLDB engine; to ''both'' RBAC and database encryption with more advanced engines.  
  
== Is a Form in Base different from a Form in MSA? ==
+
For comprehensive database security with Base, including encryption, consider HSQLDB 2.x, H2, Apache Derby, PostgreSQL 9.1 or later, Oracle with the Advanced Security option, and of course MS SQL Server 2008 or later with TDE. If you're supporting a very large number of users, and/or need concurrent MSA front-end connectivity (requiring ODBC), then select among the latter options: PostgreSQL, Oracle, or MS SQL Server.
  
Yes
+
The Base-bundled HSQLDB engine is similar to MSA's Jet/ACE engine in terms of multi-user function. HSQLDB must be run in [http://user.services.openoffice.org/en/forum/viewtopic.php?p=162653#p162653 server mode] in support of multiple users, as with alternative engines. This engine supports 'role based access control' similar to the Jet-MDB "workgroup" function. Security is likewise [http://stackoverflow.com/a/8833306 limited]. Otherwise, the primary role of the built-in HSQLDB engine is in support of the "embedded database" configuration which 'embeds' the database data inside the Base ODB container file, similar to MDB/ACCDB. This all-in-one ODB file is often referred to as a "Base database." But unlike MSA files, this "embedded database" ODB file is configured for single-user access. It's also prone to corruption, so these all-in-one ODB files are not recommended beyond database-prototyping and examples. A production database should ''always'' be deployed in a 'split' configuration using an ODB file generated by the "Connect to an existing database" wizard. In a split-configuration, no back-end database data is stored within the Base ODB file. Only front-end components such as Base Queries, Forms, Reports and Macros are stored therein. This is very similar to the 'split database' function in MSA 2010.
  
There are very real differnces between how Forms are implemented in Access and Base.  
+
There are some considerations when deploying a split database in multi-user environments. This split configuration allows you to share the front-end files (MDB/ACCDB/ODB) file for common access to front-end Queries, Forms, Reports and Macros, while maintaining multi-user access to the back-end database. You can also distribute personal copies of the front-end (MDB/ACCDB/ODB) to allow user-specific Queries, Forms, etc. -- while each maintains access to the central database(s). Personal copies of the front-end will provide the most robust/stable user environment/experience, although front-end updates become more difficult to distribute.
 +
 
 +
== Is a Form in Base different from a Form in MSA? ==
 +
 
 +
Yes.  There are very real differences between how Forms are implemented in Access and Base.
  
 
=== Virtual forms within Base forms ===
 
=== Virtual forms within Base forms ===
  
== Where are the Delete / Upate queries? ==
+
Virtual forms in Base are called "subforms". You can manage them opening the form in Edit mode and then clicking on "Form Navigator", in "Form Design" toolbar.
Base does not currently support building delete / insert / update queries in the desinger.
+
 
 +
== Where are the Delete / Update queries? ==
 +
Base does not currently support building delete / insert / update queries in the designer.
  
=== equivilant actions ===  
+
=== Equivalent actions ===  
 
==== ''using the Query Designer'' ====
 
==== ''using the Query Designer'' ====
You can achieve the equivilant actions in the GUI using the designer and or SQL commands.
+
You can achieve the equivalent actions in the GUI using the designer and or SQL commands.
  
 
==== ''using a macro'' ====
 
==== ''using a macro'' ====
Line 72: Line 83:
 
== I want to filter my form based on the contents of a combobox? ==
 
== I want to filter my form based on the contents of a combobox? ==
  
== Converting my VBA modules to Base modules ==
+
== Converting my [[VBA]] modules to Base modules ==
  
 
=== What happened to me? ===
 
=== What happened to me? ===
  
There is no exact duplicate to the ME psuedo variable in VBA.  
+
There is no exact duplicate to the ME pseudo variable in VBA.  
  
In Access VBA 'me' has attributes of two seperate objects in OOoBasic:  
+
In Access VBA 'me' has attributes of two separate objects in OOoBasic:  
 
TextDocument and DataForm
 
TextDocument and DataForm
  
Line 85: Line 96:
 
The DataForm meanwhile supports result set functions, such as First, Filter, InsertRow.
 
The DataForm meanwhile supports result set functions, such as First, Filter, InsertRow.
  
In OOoBasic the psuedo variable thisComponent normaly would be the TextDocument, while thisComponent.DrawPage.Forms(0) meanwhile would reference the first DataForm owned by the TextDocument.
+
In OOoBasic the pseudo variable thisComponent normally would be the TextDocument, while thisComponent.DrawPage.Forms(0) meanwhile would reference the first DataForm owned by the TextDocument.
  
Perhaps a still closer equivilant is to use the object ownership hierarchy to get to the form. For example if we had a single table form with a button, then in the macro called by the 'onClick' or as OOBase calls it the 'When initializing' event we would do this: Create a macro in a library named onButtonClick( oEv as object )
+
Perhaps a still closer equivalent is to use the object ownership hierarchy to get to the form. For example, if we had a single table form with a button, then in the macro called by the 'onClick' (or as OOBase calls it the 'When initializing' event) we would do this: Create a macro in a library named onButtonClick( oEv as object )
  
 
     sub onButtonClick( oEv as object )
 
     sub onButtonClick( oEv as object )
       ' oEv is the event object passed automatially
+
       ' oEv is the event object passed automatically
 
       ' it has a property SOURCE which is the  
 
       ' it has a property SOURCE which is the  
 
       ' button that initiated this call
 
       ' button that initiated this call
Line 109: Line 120:
 
=== Where is findfirst? ===
 
=== Where is findfirst? ===
  
Base does not appear to have a FindFirst function on the rowset like MS Access, what is the equivilant Base function?
+
Base does not appear to have a FindFirst function on the rowset like MS Access, what is the equivalent Base function?
  
 
MSAccess VBA example:
 
MSAccess VBA example:
Line 129: Line 140:
 
   End Sub
 
   End Sub
  
For this type of simple single column search it is easy enough to create our own find first equivilant with OOoBasic:
+
For this type of simple single column search it is easy enough to create our own find first equivalent with OOoBasic:
  
 
  Sub Find_Combo_AfterUpdate( OEv as Object)
 
  Sub Find_Combo_AfterUpdate( OEv as Object)
Line 167: Line 178:
 
     FindFirst = notFound
 
     FindFirst = notFound
 
     colIDX = oRS.FindColumn( ColName )
 
     colIDX = oRS.FindColumn( ColName )
        oRS.First
+
    oRS.First
        do  
+
    do  
          if oRS.getString( colIDX ) <> Searchval
+
      if oRS.getString( colIDX ) <> Searchval
            oRS.Next
+
        oRS.Next
            if oRS.isAfterLast then
+
        if oRS.isAfterLast then
              exit do
+
          exit do
            endif
+
        endif
          else
+
      else
            FindFirst = oRS.getBookMark
+
        FindFirst = oRS.getBookMark
            exit do
+
        exit do
          end if
+
      end if
     while oRS.isAfterLast <> True
+
     loop while oRS.isAfterLast <> True
 
    
 
    
 
  end function
 
  end function
Line 184: Line 195:
 
=== How do I set the filter for a sub-form only? ===
 
=== How do I set the filter for a sub-form only? ===
  
=== Is there an equivilant to DoCmd RunSQL ===
+
=== Is there an equivalent to DoCmd RunSQL ===
  
 
Yes, in OOoBase you would use either a Statement or PreparedStatement object to achieve the same function. With OOoBase you must also decide between using execute and executeUpdate.
 
Yes, in OOoBase you would use either a Statement or PreparedStatement object to achieve the same function. With OOoBase you must also decide between using execute and executeUpdate.
Line 214: Line 225:
 
*if the SQL statement returns no records then you must use executeUpdate.
 
*if the SQL statement returns no records then you must use executeUpdate.
  
=== If I use DLookup columns in MS Access what can I do in Base? ===
+
== If I use Lookup fields/columns in my  Access tables what can I do in Base? ==
There are two parts to this answer, given that Base does not support DLookup column types in tables.
+
There are two parts to this answer, given that Base does not support Lookup column types in tables.
  
 
When a table is displayed in a custom form use of a bound listbox will give you the same functionality. An example of [[adding a listbox to a form]] and to a grid control on a form is at this page.
 
When a table is displayed in a custom form use of a bound listbox will give you the same functionality. An example of [[adding a listbox to a form]] and to a grid control on a form is at this page.
  
In a table view ( double clicking on the table name ) there is no equivilant to this.
+
In a table view ( double clicking on the table name ) there is no equivalent to this.
+
 
 +
==How do I use Domain Aggregate functions in Base?==
 +
 
 +
Domain Aggregate functions such as '''DCount''', '''DLookup''', '''DMax''' etc have no direct equivalent in Base. You will have to write or design queries to return these results using the appropriate SQL functions.
 +
 
 +
==How do I add Calculated Controls to my forms and reports?==
 +
 
 +
Controls in Base forms and reports cannot be used to perform calculations. There are two methods available to get a calculated result on a form or report.
 +
 
 +
===Using a query===
 +
Modify the underlying data source of the form or report to perform the calculation for each record and return the result as a (calculated) field.
 +
 
 +
===Using a macro===
 +
If you need your control to update as data is entered into a form, you will need to write a small macro to perform the calculation and assign it to an appropriate event on one of the data entry controls (e.g. the Text modified event).
 +
 
 +
''Autor: [mailto:atjensen@openoffice.org?subject:OOoWiki MSA-Base Faq] [[User:DrewJensen|Drew]] 21:01, 11 September 2007 (CEST) '<br>
 +
''Please do not change the logical content of this site without
 +
acknowledge of the author or the [http://wiki.services.openoffice.org/wiki/Project_Lead OOo QA Project Lead/Co-Leads].''
  
 +
[[Category:Quality Assurance]]
 
[[Category:Database]]
 
[[Category:Database]]
 
[[Category:Base Documentation]]
 
[[Category:Base Documentation]]
 +
[[Category:User FAQ]]
 +
[http://www.christians-louboutin.org/ christian louboutin]

Latest revision as of 05:16, 12 April 2012

Common questions and answers for those migrating from Microsoft Access (MSA) to OpenOffice.org Base.

This is a user community effort - add to the knowledge base if you can.

Please however try to keep the questions and answers general. If there is an answer regarding a feature specific version of MSA then include the version number also.

Specifically, please only update the wiki if you have an answer for the question you are adding. ( If you may need to get back shortly with the answer don't let that stop you from getting the question in first however - just come back before long )

For asking specific questions or for general help it would be appropriate to then ask on either the: Base Forum or on the Base users mailing list.

Can I use Microsoft Access databases (.mdb) in Base?

On Windows: yes. You cannot open them directly via File|Open, but you can access the data therein. For this, you need an Open Document Base file (*.odb), which holds the connection information. For details see Microsoft Access or Connecting to Microsoft Access.

You can modify the data in the tables and you can add and remove records. You can create new tables, but you cannot alter the structure of existing tables.

Queries in MS Access are shown as views in the table container. You can use the query results, but you have no access to the underlying definitions and you cannot alter them.

You cannot read MS Access forms or reports.

Can I read my Base database from MS Access (MSA)?

That depends. There's no way to to link to tables stored within a Base .odb file. But there's two types of .odb files generated by Base; those with and those without an "embedded database." So if your Base .odb file is simply linked to an external, MSA-compatible, data source, particularly those offering an "ODBC" connection option, then MSA will 'Link to the data source by creating a linked table.' And you get full read/write access with the "ODBC" option. Changes made in MSA will be reflected in the data source, and therefore in Base, and vice versa.

Technically, it is possible to extract an "embedded database" from a Base .odb file through a manual extraction process. This is necessary for instance to upgrade from the built-in HSQLDB 1.8 engine to the latest HSQLDB 2.x engine in order to take advantage of newer HSQLDB features which may soon include an "ODBC" option as necessary for MSA linking. But for now HSQLDB only provides Java-based "JDBC" linking, which is noticeably absent from MSA's link options. So a third-party ODBC-to-JDBC "bridge" or "gateway" (diagram) is currently required to link MSA to a database generated by the HSQLDB engine as bundled with OpenOffice.org.

As an alternative to "bridging" it should be possible to migrate your HSQL database to one that offers "ODBC" connectivity. Most options are compatible with both MSA and Base including: SQL Server Express, H2 (tutorial), SQLite, PostgreSQL, MySQL, MariaDB, Firebird, MS SQL Server, Oracle, etc.

It is possible to use a Base .odb file to update data in a MSA database (.mdb), but only from a Windows machine. This requires the MSA database be opened and locked by the Base file.

Data could also be passed to a MSA database by linking both MSA and Base to the same CSV file(s).

Can I create an Access database (mdb file) with Base?

No. Base cannot create a new Access database file; or new tables; or modify existing table structures/properties. Base queries, forms and reports can be added to the Base .odb file, but not to the Access .mdb file.

Can I create a Switchboard in Base?

Base does not currently have a switchboard style form wizard. It is possible to achieve a very similar effect however using one of several techniques.

Opening a default form via a macro

Use a stand alone form to launch the Base database

see Tutorial: Standalone Forms / Switchboard

Base Switchboard extension

Development started to bring switchboard feature into OOo, see the Roberto Benitez's Base Switchboard extension.

Our MS Access (MSA) databases uses "Workgroup Security" to control group/user permission to view/maintain data. Is similar access control and security possible with Base?

This question highlights some fundamental differences between Base and MS Access (MSA). MSA's Jet/ACE engine is integral so even linked data-sources are accessed through Jet/ACE. This has been a problem for "database security" because the all-in-one MDB/ACCDB file supports either "workgroup" (access control) or "security" (encryption) but not both. Specifically, the Jet-MDB database format (MSA 2003 and earlier) is not truly "secure" but it does offer "workgroup" (access control) functions including individual user-login and user/group permissions. This could be combined with security features of the host file system (NTFS/EFS) to formulate crude database security. On the other hand, the ACE-ACCDB file format (MSA 2007) is relatively "secure" (encryption) but forgoes the "workgroup" function in favor of a single login. So MSA's "Workgroup Security" has been little more than an oxymoron. Perhaps so much so, that Microsoft wisely decided to depreciate "Workgroup Security" in MSA 2010 -- but continues to support the legacy function of the Jet engine for MDB files created with MSA 2003 or earlier.

So database security has now formally shifted away from built-in Jet/ACE engine, such that MSA relies primarily on the security provided by linked data-source engines. Perhaps along those lines, MSA 2010 offers to 'split the database' into front-end and back-end files. This can be accomplished manually by eliminating all Tables in a copy of the MDB/ACCDB file. But either way you'll need to skip the Jet/ACE back-end, using only the MDB/ACCDB front-end to link to a full-featured database engine supporting robust database security.

This is now very similar to Base. In Base, all multi-user databases are "split." The Base 'user authentication' feature could use some improvements, but Base is purely a front-end (client application) to a variety of database engines. The engines, themselves, provide various levels of database security: from none with dBase files or SQLite; to role based access control (RBAC) using the built-in HSQLDB engine; to both RBAC and database encryption with more advanced engines.

For comprehensive database security with Base, including encryption, consider HSQLDB 2.x, H2, Apache Derby, PostgreSQL 9.1 or later, Oracle with the Advanced Security option, and of course MS SQL Server 2008 or later with TDE. If you're supporting a very large number of users, and/or need concurrent MSA front-end connectivity (requiring ODBC), then select among the latter options: PostgreSQL, Oracle, or MS SQL Server.

The Base-bundled HSQLDB engine is similar to MSA's Jet/ACE engine in terms of multi-user function. HSQLDB must be run in server mode in support of multiple users, as with alternative engines. This engine supports 'role based access control' similar to the Jet-MDB "workgroup" function. Security is likewise limited. Otherwise, the primary role of the built-in HSQLDB engine is in support of the "embedded database" configuration which 'embeds' the database data inside the Base ODB container file, similar to MDB/ACCDB. This all-in-one ODB file is often referred to as a "Base database." But unlike MSA files, this "embedded database" ODB file is configured for single-user access. It's also prone to corruption, so these all-in-one ODB files are not recommended beyond database-prototyping and examples. A production database should always be deployed in a 'split' configuration using an ODB file generated by the "Connect to an existing database" wizard. In a split-configuration, no back-end database data is stored within the Base ODB file. Only front-end components such as Base Queries, Forms, Reports and Macros are stored therein. This is very similar to the 'split database' function in MSA 2010.

There are some considerations when deploying a split database in multi-user environments. This split configuration allows you to share the front-end files (MDB/ACCDB/ODB) file for common access to front-end Queries, Forms, Reports and Macros, while maintaining multi-user access to the back-end database. You can also distribute personal copies of the front-end (MDB/ACCDB/ODB) to allow user-specific Queries, Forms, etc. -- while each maintains access to the central database(s). Personal copies of the front-end will provide the most robust/stable user environment/experience, although front-end updates become more difficult to distribute.

Is a Form in Base different from a Form in MSA?

Yes. There are very real differences between how Forms are implemented in Access and Base.

Virtual forms within Base forms

Virtual forms in Base are called "subforms". You can manage them opening the form in Edit mode and then clicking on "Form Navigator", in "Form Design" toolbar.

Where are the Delete / Update queries?

Base does not currently support building delete / insert / update queries in the designer.

Equivalent actions

using the Query Designer

You can achieve the equivalent actions in the GUI using the designer and or SQL commands.

using a macro

I want to filter my form based on the contents of a combobox?

Converting my VBA modules to Base modules

What happened to me?

There is no exact duplicate to the ME pseudo variable in VBA.

In Access VBA 'me' has attributes of two separate objects in OOoBasic: TextDocument and DataForm

The TextDocument object would be used for controlling the window size and placement on the screen for instance.

The DataForm meanwhile supports result set functions, such as First, Filter, InsertRow.

In OOoBasic the pseudo variable thisComponent normally would be the TextDocument, while thisComponent.DrawPage.Forms(0) meanwhile would reference the first DataForm owned by the TextDocument.

Perhaps a still closer equivalent is to use the object ownership hierarchy to get to the form. For example, if we had a single table form with a button, then in the macro called by the 'onClick' (or as OOBase calls it the 'When initializing' event) we would do this: Create a macro in a library named onButtonClick( oEv as object )

   sub onButtonClick( oEv as object )
     ' oEv is the event object passed automatically
     ' it has a property SOURCE which is the 
     ' button that initiated this call
   
     dim oForm as variant
   
     oForm = oEv.Source.Model.Parent
      ' oForm is now the virtual form objct
     
     dim oDocument as variant
     
     oDocument = thisComponent
      ' oDocument is now the textDocument displayed in
      ' the window on screen
   
   end sub

Where is findfirst?

Base does not appear to have a FindFirst function on the rowset like MS Access, what is the equivalent Base function?

MSAccess VBA example:

Say there is a VB combo box which lists all the prospects in the database and allows the user to select a particular prospect and then have the form automatically go to that person's data record.

 Private Sub Find_Combo_AfterUpdate()
 Dim strCriteria As String
 
 strCriteria = "[Prospect_ID] =" & Me.Find_Combo
 
 Me.recordsetclone.FindFirst (strCriteria)
 If me.recordsetclone.NoMatch Then
     MsgBox "No entry found"
 Else
     Form_F_Prospects.Bookmark = me.recordsetclone.Bookmark
 End If
 
 End Sub

For this type of simple single column search it is easy enough to create our own find first equivalent with OOoBasic:

Sub Find_Combo_AfterUpdate( OEv as Object)
   ' Oev is the event object automatically sent
   ' to sub procedure call
   ' Oev will have a property Source
   ' that is the control that triggered
   ' the call to this procedure
 
 Dim oForm as variant ' The dataform obejct 
 
 Dim oComboBox as variant ' The combobox control
 
 Dim oBkMark as variant
 
 oForm = oEv.Source.Model.Parent
 
 oComboBox = oForm.getByName( "Find_Combo" )
   
 oBkMark = FindFirst( oForm.CreateResultSet(), "Prospect_ID", oComboBox.Text )
     ' oForm.CreateResultSet() is equivilant here to me.recordsetclone
 if not IsEmpty( oBkMark ) then
 		oForm.moveToBookmark( oBkMark )
 else
 	msgBox( oComboBox.Text & " not found" )
 end if
 
end sub
function FindFirst( oRS as variant, ColName as string, SearchVal as string ) as variant
       ' oRS is a resultSet object
       ' ColName is the name of a column in the resultset
       ' SearchVal is
   dim colIDX as integer
   dim NotFound as variant
 
   FindFirst = notFound
   colIDX = oRS.FindColumn( ColName )
   oRS.First
   do 
     if oRS.getString( colIDX ) <> Searchval
       oRS.Next
       if oRS.isAfterLast then
         exit do
       endif
     else
       FindFirst = oRS.getBookMark
       exit do
     end if
   loop while oRS.isAfterLast <> True
 
end function

How do I set the filter for a sub-form only?

Is there an equivalent to DoCmd RunSQL

Yes, in OOoBase you would use either a Statement or PreparedStatement object to achieve the same function. With OOoBase you must also decide between using execute and executeUpdate.

For example if you had the VBA line

 DoCmd RunSQL( "SELECT * FROM tContacts" )

it would become in OOoBase

 Dim oStatement as variant
 
 oStatement = OForm.ActiveConnection.CreateStatement
   ' Where oForm is a DataForm object
   ' NOTE you could do exactly the same thing with
   ' a resultSet or rowSet obejct also
   ' oStatement = OResultSet.ActiveConnection.CreateStatement
 
 oStatement.execute( "SELECT * FROM ""tContacts"""  )
 

If on the other hand the VBA line where

 DoCmd RunSQL( "DELETE FROM tContacts WHERE Status = 'INACTIVE'" )

then we would use the executeUpdate method on a statement

 oStatement.executeUpdate( "DELETE FROM ""tContacts"" WHERE ""Status"" = 'INACTIVE'"  )

The rule is -

  • if your SQL statement will return records you use execute or executeQuery.
  • if the SQL statement returns no records then you must use executeUpdate.

If I use Lookup fields/columns in my Access tables what can I do in Base?

There are two parts to this answer, given that Base does not support Lookup column types in tables.

When a table is displayed in a custom form use of a bound listbox will give you the same functionality. An example of adding a listbox to a form and to a grid control on a form is at this page.

In a table view ( double clicking on the table name ) there is no equivalent to this.

How do I use Domain Aggregate functions in Base?

Domain Aggregate functions such as DCount, DLookup, DMax etc have no direct equivalent in Base. You will have to write or design queries to return these results using the appropriate SQL functions.

How do I add Calculated Controls to my forms and reports?

Controls in Base forms and reports cannot be used to perform calculations. There are two methods available to get a calculated result on a form or report.

Using a query

Modify the underlying data source of the form or report to perform the calculation for each record and return the result as a (calculated) field.

Using a macro

If you need your control to update as data is entered into a form, you will need to write a small macro to perform the calculation and assign it to an appropriate event on one of the data entry controls (e.g. the Text modified event).

Autor: MSA-Base Faq Drew 21:01, 11 September 2007 (CEST) '
Please do not change the logical content of this site without acknowledge of the author or the OOo QA Project Lead/Co-Leads. christian louboutin

Personal tools