First Time Use....form will be blank

Adrianna

Registered User.
Local time
Today, 18:19
Joined
Oct 16, 2000
Messages
254
Okay...I'm trying to cover all pitfalls or possible complaints that I could receive when launching this new database.

From the switchboard the clients can enter the master form in add or edit mode, BUT

If for some reason they click on Edit an Existing Form before clicking on Add a New Form (for the first time), then the acFormEdit version will open blank.....just a full screen of NOTHING.

So, I want to check to see if there are any records.....If there are no records....meaning it is the first time the database has been used, deleted all of the systems, or just completed and archive, then I would like to have a MsgBox popup (and canel = true), instead of showing them a blank screen.

How can I do this....since there is no NoData() event for Forms.
 
In the form's Open Event, create a recordset clone of the forms underlying recordset. Test the recordset for EOF (no records). If so, message box then cancel.


Dim rst As Recordset
Set rst = Me.RecordsetClone
If rst.EOF Then
MsgBox "Your Message Here."
Cancel = 1
End If
 
Last edited:
I get a type mismatch error and I'm not sure why.

Everything is fine it I texted out that code...but with it in....I get the type mismatch error???:confused:
 
On which line of code are you getting the type mismatch error?
 
You have to make sure that DAO is loaded in the Reference. Then explicitly declare the variable.

Dim rst As DAO.Recordset
...

I don't think RecordsetClone is available in ADO, you may use workaround by using DCount(), if you don't want to use DAO.
 
Private Sub Form_Open(Cancel As Integer)
If (RecordsetClone.RecordCount = 0) Then
DoCmd.Close
Beep
MsgBox "There are no invoices recorded for that period.", vbInformation, "No Invoices Recorded"
End If
End Sub
 
Rich....once again....you've come to the rescue. That did the trick. I don't know why I always seem to find problems last minute:(

Anyway..thanks. I'm not sure why I was getting the type mismatch error before, but this avoids all of that mess! THANKS!;)
 

Users who are viewing this thread

Back
Top Bottom