ChaoticEmpire
There are two possible things happening...
- You are not creating new records, but an AutoNumber field is advancing
- You are creating a new record.
As stated by GingerR, your command button is doing something that is causing the quirky beahviour.
First, to verify you are creating new records, or not, a safe way to test for this is to use the Query Builder to create a simle query to display your records. If the records keeps increasing, when you re-run the query after pressing the command button, yep, you are creating additional records.
Next, what type of records are you creating -- duplicates, empty records?? Two things here -- a well designed application will accommodate two things:
a) Avoid the creation of bad records such as empty records. You can control this behaviour somewhat by changing the table design to ensure certain fields have required data.
For example, for a DVD collection, you want a title. Open the main table in design mode, and select the field used to capture the DVD titles. Make it a reqired field by tweaking the field properties.
b) Avoid the creation of duplicate records. If you have Video rental store, you may have five copies of Million Dollar Baby but each copy should have it's own reference. Your primary key is suppose to achieve this "uniqueness", but you can further prevent the occurence of duplicates by using the Title + CopyNumber (to document number of copies), and create a unique index for this pair...
[tt]
Title Copy
Million Dollar Baby 1
Million Dollar Baby 2
Million Dollar Baby 3
[/tt]
Assuming you have a "copy" field on the taable, to achieve this, open the table in design mode. From the menu, "View" -> "Indexes". Fill out the index definition as follows...
[tt]
Index Name Field Name Sort Order
OneCopy Title Ascending
Copy
[/tt]
For the Index named OneCopy, using the index properties, set the Unique field to "yes". (And yes, you would have to add the field "Copy" to your form.)
Now, you have to change the copy number each time you add the same title.
The aforementioned should give you some ideas how to prevent bad data without having to make numerous coding cheecks with the data entry screen.
But what is the command button doing?? Well, one thing that comes to mind is that the form is defined for "DataEntry" (= yes) which would mean every time you opened the form, it would assume data was to be entered.
With the form open in design mode, use the Properties window to change the DataEntry to "no"
I realize you must be frustrated, but you are making great progress. Well done...
Richard