CREATING THE 'HELLO-WORLD' APPLICATION


Note:  The following tutorial application can be downloaded here, although we highly recommend that you create this application manually using the step-by-step methods shown here:

The first abcDB application we’re going to construct is VERY simple, and yet it will demonstrate some of the basic principals we’ll need to move on to bigger and better things.  We’ll build our ‘Hello-World’ program in two steps.  First, we’ll simply make it possible to display a “HELLO WORLD” message.  Then, we’ll modify it slightly so that it will allow us to enter our name in a textbox and then have it display a message stating “HELLO YourName!”  So let’s get started …

First of all we need to create a new database, so do that now (From the 'Desktop Studio'main menu, click

-FILE menu
-MS ACCESS
-NEW

Call the new database SAMPLE).

Once you’ve created your new database, move to the FORMS tab and click NEW to create a new form.  You’ll be presented with a screen like this one.

Let’s just click the GO button.  You’ll be asked for a NAME to call this new form.  Call it HELLO

Now, let’s add a COMMAND button to our form.  Place it anywhere you please, similar to this screenshot.  Just for practice, let’s resize the button to make it larger.

Here comes the fun part.  Let’s select the button, and view it’s PROPERTIES found in the bottom right corner of the screen.

For now, we’re only interested in three of these properties.  The CAPTION, MACRO and FONT SIZE properties.

Let’s change the CAPTION so that the button will display the words “Click Me!”, and then let’s change the FONT SIZE to 14.

We’re now going to focus our attention on the MACRO property.    Notice that whenever you select a control, you can quickly and easily add code to it's various events at the bottom of the screen. The script that you enter in the MACRO property of a COMMAND button will be executed every time that the button is ‘clicked’.

Let’s select it in the list of properties, and then we’ll click the ... button to open the SCRIPT BUILDER form.

This screen is the ‘center of operations’ when it comes to programming abcDB using ‘script’ code.  Let’s look at some of the features on this screen.

There is also a button which will take us to an SQL Builder.  (See Creating Queries)Along the bottom of this screen, there are 4 dropdown lists.  Each displays a list of commonly used Statements, Functions, Controls or Fields.

For now, let’s open the Statements dropdown...

Here you can see the list of commands available in the abcDB ‘Script’ language.  Among the MANY different commands, is one called MESSAGE.  We’ll choose it from the list, and as you can see, the command is entered for us.

Notice that all the commands shown in the command list are accompanied by the basic syntax required in order to make them work.  This will help ‘jog’ your memory.  If you need more advanced help, you can always refer to the Appendixes in this manual.

In any case, notice that the syntax for our MESSAGE() command is as follows:  MESSAGE(Text // Caption)

To achieve our goal of having a “HELLO WORLD” message being displayed, we’ll need to modify our code slightly, as can be seen in the next step.

Now, whenever our COMMAND button is clicked, this code will be executed, causing 'Desktop Studio' to display our “HELLO WORLD!” message.

Let’s try it out by saving everything:

1.      ClickSAVE on this screen to save our script.

2.      Then we need to SAVE our form. 

Once you’ve saved your form, let’s run it by selecting it in the list of forms on the FORMS tab, and clicking OPEN.

If we’ve followed the steps accurately, when we ‘click’ the button, we should see a message as shown in this screenshot.

Congratulations!  You’ve just created your first abcDB ‘Application’!  Granted, it doesn’t do much, but you’ve been able to learn some of the basic essentials used in creating MUCH more powerful programs.

Wouldn’t it be cool though, if we could enter our name in a ‘textbox’ and then get abcDB to display a ‘personalized’ Hello World message?

Let’s do that now.

First, close this form, and then EDIT it.  Meet you on the next step.

Let’s add a ‘textbox’ to our form.  Add a label as well.  Position them both similar to what’s shown here.

Let’s make the following changes to the LABEL’s properties:

-          Change the CAPTION to “Enter a Name:”

Then, make the following change to the TEXTBOX’s properties:

-          Change the TAGNAME property to NAME

Finally, let’s modify the script code in the COMMAND button’s MACRO property to read like this:

MESSAGE(“HELLO “ ~NAME~//”abcDB”)

Notice that we’ve taken advantage of the OBJECTS button.  It displays a list of all the different controls that are currently on our form.  Our textbox (which we just changed to a TAGNAME of NAME) is listed, and when we select it, it is entered in our code for us.

Basically, what we’re expecting these changes to do, is to cause abcDB to display HELLO followed by the text that’s contained in the textbox with the TAGNAME of NAME. 

After you’ve made all these changes, SAVE your form, and open it. 

Let’s test it out:  Enter some text for a name, and then click the button.

PRESTO! 

But wait a minute … I realize that this doesn’t rank as one of the top 10 applications ever designed.  But Rome wasn’t built in a day eh? (oops.  A bit of my Canadian heritage coming out there. Sorry eh?!)

So let’s look at something more substantial.  Our next sample application, the ‘abcDB REALTOR’ program, will encompass many more features, and will accomplish much more than our simple “Hello World” program.