Empty Form Custom Error Msg

N

Nano

I have a form based on a query, and I have sets its proprties of
Adding Data and Deleting Data to No. So when the query's result is
zero, I get the empty box. Now I want to set up a macro that displays
a MsgBox. I don't know what should I write in condition. And secondly
in which event should I add the macro since I am refreshing the form
with requery command so it can get empty during refreshing too.

Thanking you in anticipation.

Regards,
Hasnain Raja
 
T

Tom Wickerath

Hi Hasnain,
... I get the empty box.

The empty box? Is this a reference to the white box that is a part of the
navigation buttons, where one usually sees a record number?
Now I want to set up a macro that displays a MsgBox.

I'm going to suggest that you use VBA code, instead. What do you want your
message box to say?
And secondly in which event should I add the macro...

Depends on what you are trying to accomplish.


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 
N

Nano

Thanks Tom for replying.Ok here is my case

1. I have made a form, which contains all the open calls of my Call
Log DB (Addition and Deletion of Accounts not allowed)
2. I have a button which closes the calls
3. I have another button that requery that form

Now if I have no open call I get a black sheet. Now what I want here
is:

1. If there are no open calls, a msg should appear .
2. Similary if I have closed all calls then on requery it should give
a msg

I hope now things are bit more clear to you.

Regards,
Hasnain Raja
 
T

Tom Wickerath

Hi Hasnain,
Now if I have no open call I get a black sheet.
Did you mean blank sheet?
2. I have a button which closes the calls
Is this closing a form, or simply marking a record displayed in a form as
closed?

I'm not sure I understand if your call form is closed or open at the time.
Assuming it is closed, and you open it, but it opens to a blank sheet
(because of no records), then try something like this Open event procedure to
notify the user and cancel the Open event procedure.

Private Sub Form_Open(Cancel As Integer)
If Me.Recordset.RecordCount = 0 Then
MsgBox "There are no calls.", _
vbInformation, "No Pending Records..."
Cancel = True
End If
End Sub


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top