Difference between revisions of "MSA-Base Faq"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Can I create an Access database (mdb file) with Base?)
(Is a Form in Base different from a Form in MSA?)
Line 35: Line 35:
== Is a Form in Base different from a Form in MSA? ==
There are very real differnces between how Forms are implemented in Access and Base.  

Revision as of 13:02, 28 September 2006

Common questions and answers for those migrating from MS Access to OO.o Base.


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.

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 )


Can I read my Base database from MS Access?

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.

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.


No. Base can not create a new Access database file; or new tables, queries, forms etc. within an existing 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 either of two techinques.

Opening a default form via a macro

Using a stand alone form to launch the Base database

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



Virtual forms within Base forms

Where are the Delete / Upate queries?

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

equivilant actions

using the Query Designer

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

using a macro


Converting my VBA modules to Base modules

What happened to me?

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

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



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.

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 )

   sub onButtonClick( oEv as object )
     ' oEv is the event object passed automatially
     ' 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 equivilant Base function?

MSAccess VBA example:


 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"
     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 equivilant 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" )
     ' oForm.CreateResultSet() is equivilant here to me.recordsetclone
 if not IsEmpty( oBkMark ) then
 		oForm.moveToBookmark( oBkMark )
 	msgBox( oComboBox.Text & " not found" )
 end if
end sub
       ' 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 )
         if oRS.getString( colIDX ) <> Searchval
           if oRS.isAfterLast then
             exit do
           FindFirst = oRS.getBookMark
           exit do
         end if
   while oRS.isAfterLast <> True
end function


Is there an equivilant to DoCmd RunSQL


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

If on the other hand the VBA line where


then we would use the executeUpdate method on a statement


The rule is -


If I use DLookup columns in MS Access what can I do in Base?

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


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

Personal tools