Tuesday 17 April 2012

Enough waffling... let's get stuck in.

I should point out that I am using Access 2007, which afaik was the first version to feature the 'ribbon' principle common to all products in the MS Office range. I have no knowledge of Access 2010 and have more or less forgotten all about whatever came before, although I did cut my teeth on whatever version that was. The key principles, and, I suspect, most of the key features I'll refer to are only slightly different, if at all, in 2010 or the preceding version for that matter.

On opening Access you need to create a blank database and give it a name. I would suggest that you also create a separate folder in your 'My Documents' and call it 'Trading' or similar and store /create your trading DB in there.

The opening screen presents you with a skeletal table named, unsurprisingly, 'Table 1'. The easiest thing to do is to just close this and forget you ever saw it!

As discussed in the last post only three core tables are required to create the kind of information hinted at in the first part of this adventure. So for now we are going to create a 'Trades' table, a 'Sport' table and a 'Strategy' table. In order to better illustrate the purpose of the three tables I'll suggest we actually work backwards, so let's start by creating a 'Strategy' table.

Click on the 'Create' ribbon and then select 'Table Design' and you will be presented with a strange looking blank canvass on which to stretch your DB muscles, with the cursor flashing in the left hand corner of the topmost field name. Type 'StratID' and hit the tab key across to the 'Data Type' column and select 'Autonumber'. With the 'Data Type' column still active, click on the 'Primary Key' menu item and you should see a little key appear to the left of the field name box. Ignore the Description column for this one by tabbing through it to take you to the next Field Name and enter 'Strategy' and 'Text' in the field name and Data Type columns respectively. Your screen should now look like this:


Notice the little key symbol and that I have edited the Field Size in the Strategy field to 60 instead of the 255 the programme defaults to. There is no point in having large field sizes that won't all get used, a point we'll come back to in due course. That is all there is to it! On clicking to close the table you'll be prompted to name it - choose 'Strategy' for now and save your work. Now is a good time to double click on your newly created table and put some data into it. Even if you don't have named strategies as such please humour me and put a couple of trade styles in - even if it's only 'Correct Score Lay' or 'Scalp 0-0' - the idea is to show you possibilities. Notice that as you enter each strategy the StratID is added automatically. Perhaps as the 'Data Type' is 'Autonumber' this won't be too much of a surprise.

Perform a similar exercise to create the Sport table, again  an ID column ('SportID') of Autonumber data type and a field named Sport with Text data type. Again make the SportID field the Primary Key, and set the size attribute of the Sport field to say 50. Your table in design mode before saving should look like this:



Save the table as 'Sport', and again open it up and put the sports you are likely to trade in the table. Again even if you only ever intend to trade Origami please humour me for now and put four or five sports in your Sport table.

We now have two populated data tables and in the next step we'll construct the actual Trades table and start wiring the whole thing up.

No comments:

Post a Comment