Difference between revisions of "Vprašanja pri prehodu MSA-Base"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Razširitev Stikalna plošča Base)
(Se obrazec Base razlikuje od obrazca v MSA?)
Line 59: Line 59:
 
== Se obrazec Base razlikuje od obrazca v MSA? ==
 
== Se obrazec Base razlikuje od obrazca v MSA? ==
  
Da. There are very real differences between how Forms are implemented in Access and Base.
+
Da. Obstajajo velike razlike med implementacijo obrazcev v Access in Base.
  
 
=== Navidezni obrazci v obrazcih Base ===
 
=== Navidezni obrazci v obrazcih Base ===
  
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.
+
Navidezni obrazci so v Base poimenovani "podobrazci". Z njimi ravnate tako, da odprete obrazec v urejevalnem načinu in nato kliknete "Krmar po obrazcih" v orodni vrstici "Oblikovanje obrazca".
  
 
== Kje so poizvedbe Izbriši / Posodobi? ==
 
== Kje so poizvedbe Izbriši / Posodobi? ==

Revision as of 15:49, 4 January 2009

Pogosta vprašanja in odgovori za tiste, ki prehajate iz Microsoft Access (MSA) na OpenOffice.org Base.

To je projekt skupnosti uporabnikov - dodajte znanje, če ga lahko.

Vendar ohranite vprašanja in odgovore splošne. Če je vprašanje, ki zadeva funkcionalno določeno različico MSA, vključite tudi številko različice.

Natančneje, wiki posodobite le, če imate odgovor na vprašanje, ki ga dodajate. ( Če ne morete takoj vnesti odgovora, naj vas to ne ustavi, da ne bi najprej vnesli vprašanja - le ne vrnite se prepozno. )

Če želite zastaviti specifično vprašanje ali za splošno pomoč raje povprašajte na Forumu Base ali na dopisnem seznamu uporabnikov programa Base.

Lahko uporabljam zbirke podatkov Microsoft Access (.mdb) v Base?

V okolju Windows: da. Ne morete jih neposredno odpreti prek Datoteka|Odpri, vendar lahko dostopite do vsebovanih podatkov. Za to potrebujete datoteko zbirke podatkov Open Document (*.odb), ki vsebuje podatke o povezavi. Podrobnosti najdete v Povezovanje z Microsoft Access.

Spreminjate lahko podatke v tabelah, dodajate in odstranjujete lahko zapise. Ustvarjate lahko nove tabele, vendar ne morete spreminjati strukture obstoječih tabel.

Poizvedbe MS Access so prikazane kot pogledi v vsebniku tabele. Rezultate poizvedbe lahko uporabite, vendar nimate dostopa do podležnih definicij in jih ne morete spreminjati.

Obrazcev in poročil MS Access ne morete brati.

Lahko berem svojo zbirko podatkov Base iz programa MS Access?

Ne obstaja noben način, da bi uporabili mehanizem povezovanja s tabelami Access za povezovanje z zbirko podatkov Base.

Z zbirko podatkov Base lahko posodobite podatke v zbirki podatkov Access. Trenutno je za to potrebno, da zbirko podatkov Access odpre in zaklene datoteka Base.

Podatke bi lahko vrnili v zbirko podatkov Access, če bi ustvarili povezano datoteko CSV v zbirki podatkov Base. Nato bi povezali s to datoteko CSV tabelo v zbirki podatkov Access.

Lahko ustvarim zbirko podatkov Access (datoteko mdb) z Base?

Ne. Base ne more ustvariti nove datoteke zbirke podatkov Access niti novih tabel, poizvedb, obrazcev itn. v okviru obstoječe datoteke mdb.

Lahko z Base ustvarim stikalno ploščo?

Base trenutno nima čarovnika za obrazce v slogu stikalne plošče. Vendar je mogoče doseči zelo podoben učinek z eno izmed treh spodnjih tehnik.

Kako odprem privzeti obrazec prek makra

Uporaba samostojnega obrazca za zagon zbirke podatkov Base

Razširitev Stikalna plošča Base

Začel se je razvoj orodja za stikalne plošče v OOo, oglejte si razširitev Roberta Beniteza Stikalna plošča Base.

Naša zbirka podatkov Access uporablja "Varnost delovnih skupin" za nadzor dovoljenj skupin/uporabnikov za ogledovanje/vzdrževanje podatkov?

This question points out what is a fundamental difference between OOoBase and MS Access (MSA). In the case of MSA 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.

In Base (OOoBase) this is not the case at all. The Base database document is simply a front end (client application) to a variety of database engines. In one of these forms it embeds 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.

You are free to use Base as the front end to a HSQLDB database in server mode. HSQLDB is a very small footprint, low administration 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, PostgreSQL, Firebird, Oracle, or MS SQL Server.

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.

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.

Se obrazec Base razlikuje od obrazca v MSA?

Da. Obstajajo velike razlike med implementacijo obrazcev v Access in Base.

Navidezni obrazci v obrazcih Base

Navidezni obrazci so v Base poimenovani "podobrazci". Z njimi ravnate tako, da odprete obrazec v urejevalnem načinu in nato kliknete "Krmar po obrazcih" v orodni vrstici "Oblikovanje obrazca".

Kje so poizvedbe Izbriši / Posodobi?

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

Ekvivalentna dejanja

Uporaba oblikovalca poizvedb

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

Uporaba makra

Želim filtrirati svoj obrazec glede na vsebino kombiniranega polja?

Pretvorba mojih modulov VBA v module Base

Kaj se je zgodilo z 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

Kje je findfirst?

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

Primer MSAccess VBA:

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

Kako nastavim filter le za podobrazec?

Ali obstaja ekvivalent 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.

Če uporabljam polja/stolpce Lookup v svojih tabelah Access, kaj lahko storim v 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.

Kako uporabim funkcije Domain Aggregate v 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.

Kako svojim obrazcem in poročilom dodam izračunane kontrolnike?

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.

Uporaba poizvedb

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.

Uporaba makra

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).

Avtor: 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.

Personal tools