Database - Frequently Asked Questions
1. Syntax error in query" in DatabaseThis message can appear when sorting or filtering a table or creating a query and is caused by invalid table or field names. The three most common problems when creating field and table names are:
To change a table name, make sure the table is closed and go to the "database manager" screen. Click once on the table and then click again to activate the rename box. Delete spaces or hyphens (or change to to underscores) To change a field name, open the table and select Format/Table. In the format table dialog, edit the names so there are no spaces or hyphens. These rules do not apply to the field captions. 2. How do I connect to an Tesco Complete Office Database with ASP?So you've got Microsoft Internet Information Server (IIS)and you want to use ASP to interact with an Tesco Complete Office Database. For the purposes of this exercise, you can treat an Tesco Complete Office database in exactly the same way as a Microsoft Access database. IIS ships with drivers for Jet databases and so there's no requirement for an ODBC driver or any other software to be installed on the server. Below is a compete listing for an ASP page that will a) open an Tesco Complete Office Database and b) dump a specified table into a web page. The code assumes: "test.adb" - database name The code does not require a Data Source Name (DSN) to be setup on the server since it explicitly states the database driver and name. It would be better practice to switch to a DSN in the longer term. <HTML> 3. Multiple fields on the last line of Address labelProblem: How to get multiple fields on a single line of the address block in a label report. Solution: Use Format/Group to "group together" fields. Example: Select File/New/Report/Labels and follow the wizard as per normal. You'll end up with a label that looks something like:
Next, re-arrange the label to like this:
Finally, select all the fields on the last line (use the mouse) and select Format/Group from the menus. 4. How do I create address lables
The report can now be previewed and printed.
5. How do I fill a sheet of labels with the same addressWhat 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:
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:
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:
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:
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. 6. Quick Database tutorialThis is a step-by-step guide to creating an address book type database for those new to Tesco Complete Office's Database.
7. How to import ASCII textASCII or plain text must include a header line denoting field names. An example of the ideal format is as follows: "FirstName", "LastName",
"Company", "Age" Notes:
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. 8. Simple Address book example connecting with WriteHow 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. 9. Database compatibility with MDBThe 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:
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() 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). 10. Can Database be used with MySQLMySQL 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. 11. Creating a database of hyperlinksSuppose 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:
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: 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 12. How to create a SwitchboardA "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. 13. Start Database and open a formHow 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 14. Default sort orderThe 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:
15. How do I insert a row in database (and how to set a default sort order)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. 16. Parameter entry before running queriesSuppose 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. |

