How to display a message box when form has no records.

  • Thread starter Thread starter GA
  • Start date Start date
G

GA

Can someone please help me with this.

I have a form with a tab control containing multiple subforms on the
tabs. It records data against a person record.

Everything works fine except that if the form is opened before the
user has created any person records then the form is blank.

I need to display a message box to tell the user that they must first
create at least one person records using a button on my main form
before they can record any data.

I could just put a dummy record in so that when the database is
installed this doesn't happen, but I'd like to handle it a bit more
elegantly.

TIA for any suggestions,
GA
 
On Wed, 05 Oct 2005 20:27:41 +0100, GA

Solved it within seconds of clicking send 8^)

I used the button that opens the form rather than the form itself and
added code to it :-

If DCount("*", "[tbl_people]") < 1 Then
MsgBox ("You haven't created any people yet. You must do so before
you can record data.")
End If

If there's an intrinsic weakness here I'd still appreciate comments.
Thanks
GA
 
I am assuming you enter your person records in another form. If this is
correct, you can add some code to the open event of your tab control form to
see if there are records in the person table and present a message box and
close the form if there are not.
 
Back
Top