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

Recordcount of subform

Status
Not open for further replies.

eveCalypso

Programmer
Apr 29, 2003
134
GB
Good Day All,
I have consulted the FAQ's but could not find what I was looking for - maybe you can help.
This must be extremely simple, however, I can not access what I need!

I would like to know what the recordcount is for a subform. Basically I want to know if there are any records at all - if there are no records, I can allow the parent entry to be deleted. So maybe I do not even need the record count.

Any help/advice would be appreciated.
Regards,
EvE
 
Hi!

If you've setup relatinship with enforced referential integrity, and not used cascade delete related records option, you would not be allowed to delete the parent record.

Else you could probably get the count of records from the subform using something like this:

[tt]If me!SubFormControlName.Form.RecordsetClone.Recordcount>0 then
' perform the delete
end if[/tt]

Name of the subformcontrol, usually the same as the name viewed in the database window, but can also be different.

Roy-Vidar
 
Thank you very much for that!
SubFormControlName.Form.RecordsetClone.Recordcount is what I was looking for, as I kept trying
SubFormControlName.Form.Recordset.Recordcount

My database is set up correctly with the correct referential integroty. It is logic within some items which reverses the process though, so I can not let the database handle everything in this case.

Thanks again!

EvE
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top