Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

new record, then previous leaves new one there??? 2

Status
Not open for further replies.

MHadden

Programmer
May 13, 2001
105
Folks,
I have searched this site & others for days now & can't find anything. I hope it's not that Imissed it, I hate to ask for help when it's already been posted.
Anyway, I guess that's the disclaimer - now for the problem:

I have a form, that when you click on the navigation button to create a new record, it goes to a new record, as it should, however, if you click on the previous one - without typing any values into the new record, it does not delete the new one. As an example: you could actually click on the button 10 times, close the db, re open it & have 10 "records" that are all blank. Any help is greatly appreciated!

Thanks in advance,
Michael

MichaelHadden@yahoo.com
If you give someone a fish, you have given them a meal. If you teach someone to fish, you have given them MANY meals!
 
Take a look at the BeforeUpdate and/or BeforeInsert event procedures of the form.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
It appears you have some code, or by other means populate part of the record (one or more controls bound to the forms recordsource). When moving to a new record if you don't undo it prior to moving to another record, then Access will save it. Using the before update event of the form, as mentioned by PHV, you can prevent the save if you like (use a me.undo or cancel=true based), based on some criteria of your choosing.

Roy-Vidar
 
Thank you both!
PHV thanks for the "push" in the right direction & to Roy-Vidar for clarifying it further.
I moved the code that was causing the problem to a different event & it works great now.

Once again, I thank you!!!
- Michael

MichaelHadden@yahoo.com
If you give someone a fish, you have given them a meal. If you teach someone to fish, you have given them MANY meals!
 
How are ya MHadden . . . . .
[blue]when you click on the navigation button to create a new record, it goes to a new record, . . . . if you click on the previous one - [purple]without typing any values[/purple] into the new record, it does not delete the new one.[/blue]
This is not normal for Access.
Many Sources said:
[blue]Access Only Saves Edited Records![/blue]
The [blue]Dirty Property[/blue] of a form tells Access wether a record has been edited or not, and [purple]it is here Access looks to determine if a record should be saved.[/purple]

When a record is edited, this [blue]property is set to true[/blue] along with the [blue]Pencil Icon[/blue] that appears in the [blue]Record Selector[/blue] to indicate [purple]Edit Mode[/purple]. And mind you, [purple]Default Values & writing to textBoxes thru VBA, Do Not Trigger Edit Mode![/purple]

Now, there are several ways to save a record in a form. You can even force saving through VBA (one method is to set the Dirty Property to False), but as far as a form is concerned, [blue]if the record is not [purple]Dirty[/purple] its not saved.[/blue]

So if your saving unedited records, I'd say you have a problem . . . . somethings wrong! . . . .




Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top