Full Version: Don't load form if no records
UtterAccess Forums > Microsoft® Access > Access Forms
djbosch
Is there a way to check a form on loading to see if there are any records and if not to cancel the loading of the form?
et me explain - I have a system that exports records to a mainframe accounting system, but before it does, I want to be sure all records are verified, I'd like my verify screen to pop up before the export, but only if there are records to display. Any thoughts?
Thanks!
freakazeud
Hi,
You can use a Dcount() function for this e.g.:
If Dcount("*","YourQueryTable") > 0 Then
'do nothing there are records
Else
Cancel = True
End If
You are checking the form's underlying data source to see if that holds any records.
HTH
Good luck
djbosch
Thanks! That worked great!
freakazeud
You're welcome.
Good luck on future projects!
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.