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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clean up form table

Status
Not open for further replies.

Trudye

Programmer
Joined
Sep 4, 2001
Messages
932
Location
US
I have a form that allows the User to add new records using the New Record button on the Navigation bar. Does anyone know how a quick and dirty way to delete blank records before closing the form?

The me.delete command does not exist. Do I have to define the form table in the form close event and scan the table for null values? Or is there some slick way of doing it?

Lover of quick and dirty
Trudye
 
I am certain there must be cetain fields on your table that are required and that will not accept a null value. when your blank record hits the table, Access will not accept it with those null fields.

You could also use the forms before update event to test that critical fields have been input and if not, set cancel = true, or cancel the updateand give the user a message box to update information, etc. Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
Hi:
I have a (main) form that accumulates the total of check deposits (DepositAmount) from a sub form. If the main form is opened it picks up the next sequential ID (DepositNumber). If no deposits are recorded, I don't want to save the main record. So "On close" I delete all records with a zero DepositAmount, with the following query run from a macro:
Code:
DELETE tblDeposits.DepositNumber,_
     Nz([DepositAmount],0)
AS Expr1
FROM tblDeposits
WHERE (((Nz([DepositAmount],0))=0));

(Hi, Bob)

Gus Brunston [glasses] An old PICKer, using Access2000. I manage Suggestions welcome. padregus@attbi.com
 
Thanks a lot guys, I think I'll try them both just for future reference. I'll let you know how it works out.



Trudye
 
Hey Gus,

Your method will work very nicely. I am just so lazy if I can get Access to do the work for me, I'd as soon sit back and let my rules deal with the problem.

A trick I learned while building databases as lists ala PICK.

Just another Pick strummer. Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top