Tesco Software > Complete Office > Frequently Asked Questions > Database
|
| FirstName Lastname Company Address Town State Zip |
Next, re-arrange the label to like this:
| FirstName Lastname Company Address Town State Zip |
Finally, select all the fields on the last line (use the mouse) and select Format/Group from the menus.
Start Database: Start/Programs/Tesco Complete Office/Tesco Complete Office Database.
Create your address book: If you have already created your address book in Database skip to step 4. If not, create a new database with File/New and enter a new name. Add a table by selecting File/New/Table, select Table Wizard, select the "Customer" table, click Next, click the ">>" button to add all the fields and then click the Finish button. Click OK and then give your table a name, e.g. Addresses.
Add your data: Double-click on the new table to open it and then add some real names and addresses.
Create a label report: Select File/New/Report and choose the Labels option. Choose the label type to match the type of label stationery you have (nearly all stationery will match a known Avery label format). Click Next and choose a table (e.g. Addresses). Click Next and choose the fields for your first line of the report - e.g. cust_title, firstname, lastname - use the ">" button to select these fields. Click Next and add the remainder of your fields. Click Finish.
The report can now be previewed and printed.
What you want is to print a sheet of labels with the same name and address, say 8 labels. You can do this using Tesco Complete Office's relational functions. The solution seems a little long-winded perhaps but it does mean that you can choose any address by changing a single field.
Suppose you have a client table that looks like this:
| ClientID | ClientName | Address1 | Address2 |
|---|---|---|---|
| 1 | Phil Roach | 11 Petworth Court | San Francisco |
| 2 | Andy Smith | 38 St Saviours Wharf | Durham |
| 3 | Chris England | 23 Kingston Drv | Sydney |
Note: The table above has a "ClientID" field that uniquely identifies any particular record. You could use "Name" - but what happens if you have two "Andy Smiths"? If your name and address table has not already got a primary key, add one! (e.g. Select Format/Table, add a new field "tablenameID" and make type Incremental. Click Format and set Index to be Primary).
Repeat Labels Step 1
Create a table with the name ClientRepeat. It has two fields and a single record:
| ClientRepeatID | ClientID |
|---|---|
| 1 | 2 |
Make "ClientRepeatID" an incremental field and the primary key. Make "ClientID" of type numeric and select the Format button to set the numeric format to Long. This table stores the ClientID that you want to print out - in this case, ClientID is set to "2" which is the record for Andy Smith.
Repeat Labels Step 2
Next, create a table with the name LabelRepeat. It has one field and the record is repeated for the number of labels you want. In our example, we want 8 copies of a label so there are 8 records as follows:
| ClientRepeatID |
|---|
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
Make "ClientRepeatID" of type numeric and select the Format button to set the numeric format to Long.
Repeat Labels Step 3
Create a new relation with the name LabelPrn that joins the above tables together. Here's what the relation looks like in the create relation dialog:
| Left Table | Join Field | Right Table | Join Field | Join Type |
|---|---|---|---|---|
| Client | ClientID | ClientRepeat | ClientID | Inner |
| ClientRepeat | ClientRepeatID | LabelRepeat | ClientRepeatID | Inner |
Repeat Labels Step 4
Now create a new label report. When prompted, base the lable on the Relation LabelPrn and then proceed as normal (see FAQ 4 for more details).
How it works
Enter the "ClientID" of the address you want to replicate in the ClientID field of the ClientRepeat table. This table is relationally linked to both the LabelRepeat table (save's typing the ClientID 8 times) and the Client table to pull through the actual data.
This is a step-by-step guide to creating an address book type database for those new to Tesco Complete Office's Database.

- Create a report with View/Report
- Create mailing labels using File/New/Report and selecting Labels in the wizard
- Search for data (use the Find button)
- Sort and filter the data (use the right-click menu).
ASCII or plain text must include a header line denoting field names. An example of the ideal format is as follows:
"FirstName", "LastName", "Company", "Age"
"Phil", "Roach", "Tesco Complete Office Plus Software", 37
"John", "Speak", "", 45
"Charles", "Stuart", "House of Stuart", 498
Notes:
It is good practice to surround text fields by double quotes
If a text field is blank, still enter both sets of quotes (see line 3 in above example)
Numeric fields do not require quotes
Each record must begin on a new line
Commas must be used to separate fields
You can check the format of the data you are trying to import using Notepad (Start/Programs/Accessories/Note). If necessary, manually add the field names at the top of the data.
How about a very simple example that shows a Database with an address book that allows browse and edit and can create a letter in Write at the click of a button.
Open the database and look at the "AddressForm" form. There is a button that runs a macro to insert the current record's address into a new Write document. The code can easily be changed to support a "Create Envelope" function by a) Createing an envelope template in Write and b) changing "NORMAL" to "ENVELOPE" in the code.Â
Templates are easy to make yourself. For example, to create your own template that contains your address in the top right corner of the page, try these steps:
Repeat step 7 each time you want to use the template.
For more information, select Help/Write Help and look up Templates in the index.
The Database format we use is identical to Microsoft's MDB. However, there are different versions of MDB format and these are generally not backward compatable. For example, Microsoft Access 97 cannot open a file created with Access 2000. Similar applies to Tesco Complete Office. The following table sums it up:
| MDB/ADB version | Tesco Complete Office | Microsoft |
|---|---|---|
| Tesco Complete Office Database | Tesco Complete Office Database | Access 2000, 2002 & 2003 |
Note: the above does not imply that Microsoft Access 2000 can open Access 2002 files - for this complication, please refer to Microsoft!
In general, Tesco Complete Office (and Access) will update the mdb or adb to the latest version. This is usually desireable unless you need to have the file opened by some earlier version (of Access generally). You can use DAO methods to change the database version back to "3" from "4" (earlier is not possible) as follows:
1. Start Database and select Tools/Macros and create a new macro called ConvertJetMDB
2. Copy and paste the following code to create the macro
Sub ConvertJetMDB()
dbName = "C:\path\olddb.MDB"
dbNewName = "C:\path\newdb.MDB"
Set dbdao = CreateObject("DAO.DBEngine.36")
MsgBox "DAO OK, version is " & dbdao.Version
dbver = 32
dbdao.CompactDatabase dbName, dbNewName, ";LANGID=0x0409;CP=1252;COUNTRY=0", dbver
Set newdb = dbdao.OpenDatabase(dbNewName)
MsgBox "Database opened OK - format version is " & newdb.Version
End Sub
3. Adjust the database names to suit and right-click Run to convert the mdb
The end result is an Access 97 compatible database that can be opened by Tesco Complete Office Database, Access 97 (and later).
MySQL is a poweful Database Server that is used on many database driven websites - see http://www.mysql.com. Tesco Complete Office Database can be used to act as a "front end" - the application that displays and edits data. The following steps outline how to connect the two. It assumes that Tesco Complete Office Database is running on the local Windows PC and MySQL is running on a server (remote or local).
You can now use and edit the table as though it were a normal Tesco Complete Office table.
Suppose you want to use database to store information that has some associated external file or image or web site.
You can use a database field to store the location of the external file and the use the HYPERLINK function to provide a connection to the file.
Here's how to do it:
| htitle | Character | |
| hpath | Character | Click Format and set Width to 255 |
| hlink | Calculated | Click Format and set Formula to: =HYPERLINK(hpath, htitle) |
| Description | Memo |
Now, whatever you type into the hpath field can be loaded when in form view. For example, suppose you have an image stored in My Documents called photo1.jpg, then set:
htitle: Photo1
hpath: C:\Documents and Settings\Phil\My Documents\photo1.jpg
Description: Holiday snap
Open the table in Form view (e.g. click on the View Form button) and click on the link "Photo1". The image will be loaded in your default jpg editor (Tesco Complete Office Photopaint would work well).
In the same way, you can link to folders, web sites, word processing files - anything that Windows Explorer can understand can be used in a hyperlink.
For an example database, take a look at HYPERLINKS.ADB
A "Switchboard" is Microsoft Access speak for a form with buttons that open up other forms (or tables or queries).
Suppose you want a form that acts as a central point to the user and allows him to choose other forms or tables or run macros. Here is a guide on creating such a form:
Note that the above are all single line macros - you can make them as simple or complex as you want. The last of the above examples exits the database application.
You can now edit the form and add text (and pictures) to make it more user friendly.
How to open a database from the desktop and automatically display a form
First Part: create a link on your desktop that runs the database application
Second Part: create the macro to open a form
Now you can close the database and test the link on the desktop - the result should be that the form you want is displayed
The default sort order in Database is determined by the Primary Key. This can be set using Format/Table, clicking on a field, selecting Format and then setting Index to Primary Key. When adding new records, the table will show the new entries at the bottom of the table. As soon as the table is closed and re-opened, the table will be sorted according to the Primary Key.
Primary Keys are important in database design. They provide the unique identifier for a record. So usually, you should not use fields like "surname" or "company name", since you cannot guarantee these will be unique. If your table has no obvious candidate for a primary key (e.g. product number, or policy number etc), then simply add an incremental field to your table and set it to be the primary key.
If you want to work with a table in some pre-defined sort order that is different to the primary key, then create a separate Sort Order. A quick example is as follows:
The short answer is you cannot insert rows in database table
Tesco Complete Office Database is a relational database manager and the concept of inserting rows is alien to it's operation (there is no SQL statement to do this). From the database engine's point of view, the question is how to present the records in a given order.
The solution from this perspective is to create a sort order to match the order of records you want. E.g. open a table and select Format/Sort Order.
Also note that best practice when creating a table is to specify a primary key - a field that contains a unique identifier for each record. This is typically a code of some sort. If there is no obvious field, simply add an Incremental field to your table and specify it to be the primary key as follows:
Note that a table containing a primary key will use this as the default sort order. New records will appear at the bottom of the table but on closing and re-opening the table, the records will be resorted.
Suppose you have a defined a query and each time you run it, you want to prompt for a paramater or date range.
MS Access will automatically prompt for unknown query parameters. Tesco Complete Office does not do this but it is possible to setup a small system of tables and forms to do the same.
To see how this can be done, please download and open the following example: QUERYPARAMS.ADB
In the above baseTable is the data you want to set the paramters for the query. There are two examples: a set number example (see the form: FormNumberQuery) and a date range example (see the form: FormDateQuery).
These examples are largely self explanatory. In brief, they each use a dummy table to store the query parameters and then relate with the base table, limiting the result to the values in the dummy table.
For a more in depth explanation, please email support stating what it is that is not clear.
is as the default sort order. New records will appear at the bottom of the table but on closing and re-opening the table, the records will be resorted.