CREATING AND EDITING FORMS

Move to the FORMS tab.

Note:  The following screenshots are taken from the States application.

Let’s assume that we now want to create a form that will allow us to add new counties.  How can we do it?  Simple. 

Let’s start by clicking the NEW button. (If we wanted to we could just as easily EDIT an existing form by selecting it and clicking EDIT)

Here we need to choose the table (or query) that we wish our new form to receive its data from. 

In this case, we’re going to build a data-entry form for Counties, so let’s choose our counties table … tblCounty. 

Click GO! to continue …

Here we need to enter the name we wish to call this form.  Let's call it 'frmCounties' and click OK to continue.

First of all, notice the TOOLBAR down the left side of the screen:


This toolbar consists of the various types of 'controls' that you can add to your forms.  From left to right they are:

Textbox
Label
Button
Dropdown
Grid
Checkbox
Image
DatePicker
Tab
Scribble


Let's choose a TEXTBOX by 'clicking' it.  After we've selected the 'textbox' tool, simply 'click' anywhere on the 'form'.  (NOTE:  You can either 'click' in the form to place a default sized textbox OR you can 'click and drag' on the form to create your new textbox precisely the size you'd like)

(NOTE:  At this point it might be good to point out the LOCATION property.  You can either 'move' the textbox by 'dragging' it on the screen, OR you could manually enter a new location in the LOCATION property.  The same basic principals apply to the SIZE property of your form's controls.)

Now what we want to do is to 'bind' this textbox to the STATE field in our tblCounties table.  Notice in the bottom right corner of the screen, there is a list of all the 'properties' for your selected control.  The 1st property under the DATA category is the 'Bound_Field' property.

As long as you selected the tblCounties table when you first created this new form, you should find a list of all of the tblCounties fields in the 'Bound_Field' property.  Choose STATE.

Now, repeat the last few steps and add another textbox to your form.  This time bind it to your COUNTY field.  When you're done, your screen should look similar to this:

When you're all done, click the EXECUTE button from the top tool bar ().  Note:  When prompted about debugging this form, answer NO).

Voila!  Here we are viewing our very first form!

We can see from our navigation menu that there are a total of 3223 counties in our database. 

Let's try adding a new state and county by clicking the  button at the bottom of the abcDB PocketPC 'emulator'.

Here we are on a brand new ‘blank’ record.  We can now enter a new county and state.  For example, let’s add a fictious state called ZZ and a county called abcDB.

To save our record, simply move to any other record (ie. Tap the NEXT  button on the bottom toolbar.)

That was easy wasn’t it?

But wouldn’t it be nice to be able to select our STATE abbreviation from a list instead of manually typing it in.  This would improve not only the speed of entry, but it would also eliminate spelling mistakes. 

Well, this is actually a VERY easy thing to accomplish.  Let’s do it now.  First of all, click the (Close form) button to return to the abcDB form editor. 

 

Ok, here we are back ‘editing’ our Counties form.  Remember … we want to be able to choose the STATE abbreviation from a list rather than entering it manually. 

One way of doing this is to use a DROPDOWN control.

1. Select the STATE textbox.
2. Once you’ve ‘clicked’ the STATE textbox, you can DELETE it by simply tapping the DEL (delete) key on your keyboard.

Now let’s add a dropdown box in place of our now deleted textbox. 

1. Select a DROPDOWN control  from our list of controls and place it on your form.
2. Make sure you 'click' on your new dropdown to ensure it's selected.  You can then modify it's properties.

3. Choose the STATE field from the list of fields contained in the Bound_Field property

At this point, your form should look similiar to this:

* Notice that in the list of properties for our new dropdown, there is a property called SQL. 

Now, to ‘populate’ our dropdown box with the list of states, we have two options:

1. ENTER HARD-CODED LIST
In the SQL property, we could enter a hard-coded list of items. For example, we could do something like this:

“AK,AL,AR,AS,AZ,CA”

We can enter any series of items, as long as they are separated by commas and enclosed in double quotes.

This would work fine, but we’ve already got a table that contains all the different states, why don’t we just fill our dropdown box with all the records in that table?  Here’s how:

2. ENTER AN SQL STATEMENT
a. Click the ‘…’ button at the far right side of the SQL Property.  This will open our SQL Builder:


Using the Query Builder that we learned about in the QUERIES section of this help file, we can quickly and easily create the query we need.

In this case, we want to return all the STATE abbreviations in the tblStates table.  Notice that we’ve also chosen to sort our state list alphabetically in ascending order.

When you're satisfied with your new 'query', you can click the SAVE button, and abcDB will insert the correct code in your dropdowns SQL property.



 

SAVE your form, and then OPEN it.  If you've followed these instructions correctly, you should see something like this:

Now our STATE field allows us to choose from ALL the abbreviations!

As you can see, creating forms in abcDB does not have to be difficult..  In this case we’ve created a perfectly useable form in just a matter of minutes.  However, there obviously isn’t a lot of ‘power’ behind this form.  It doesn’t accomplish much other than adding a State and County to our table.

So let's go to the next lesson and learn how to use TAB CONTROLS!