Delete Subform of a subform data on exit?

hinesbrad

Registered User.
Local time
Today, 01:08
Joined
Jul 15, 2009
Messages
10
Hi everyone.

I've come across a challenge on a sub of subform situation that I've had some challenges with. I have a form designed to accept input related to picker efficiency and you have all helped me tremendously - thank you.

My next question is on the forms exit event. Since we're using a subform in a subform, it's possible for a user to enter data into the data sheet of this form, and then later decide to abandon the entries that they have made.

What I'd like the exit button to look at is determine if there are any records that exist within the datasheet. If there are, then determine if the user wants to keep the records in the database or not.

It would seem, at the surface, that I would need to do something with ADO or DAO on this. I'm not certain which would be better for a standalone data file. Nor am I sure if what I want to do is possible.

So - what I'm hoping to learn is:

- Get a kick butt reference for ADO or DAO (whichever is more appropriate in this case)
- Learn the logic behind checking for records in the subform of the subform that compares the barcode ID on the main form to the data in the subform.
- and finally, if I use ADO.NET, how I use the connection parameters to point to the access data file I am using. (I expect the name and file location to change frequently in the future).

Thank you for all of your assistance.

- Brad
"Nah - we aren't Mexico. We're *NEW* Mexico. That means we have the complete lack of class as the 'old' Mexico, but the same chronic taxation and power hungry tendances as the traditional fare of Yanks get. We proudly tout our state as the most expensive third world country anyone can visit with lots of hot air balloons, and health spas nobody can afford."
 

Attachments

  • LogWarehouseTimePost.jpg
    LogWarehouseTimePost.jpg
    83.2 KB · Views: 96
  • LogWarehouseTimePostBandW.jpg
    LogWarehouseTimePostBandW.jpg
    87.5 KB · Views: 123
you dont have to use code

not 100% sure exactly what you are trying to do

but you can have a select query to count if there are any records
and a delete query to delete them

(you dont have to do both its just that i often do this sort of thing and you cant get the count from an action (delete) query

Code:
pseudo code

count records
if recordcount=0 then
  inform the user
else
  final confrimation delete
  delete them
end if



you just need to get the query criteria referred to correctly - either with an appropriate field test, or by testing a global variable - whichever method you normally use
 
Ok - I think I have the basic idea.

The problem is I haven't been able to find the code that does the recordcounting. Would I need to use ADO or DAO to do this with some SQL? Could you recommend an introductory tutorial on how to use these?

(Maybe "Select COUNT() from table stops where barcodeID = 3")?
 

Users who are viewing this thread

Back
Top Bottom