Warning dialogue box at startup

B

Bugsy

Hi I have created an 'events' db for use at work. When starting the db I
would like to be able to display a dialogue box that gives a warning if there
is an event scheduled for that day. Is there a simple way to do this or do I
have to undertake some form of programming, which I am not conversant with!!
Many thanks
 
A

Allen Browne

Create a (continuous view) form to show today's events.

Its source query will have this in the Criteria row under your date field:
Date()

Cancel the Open event procedure of the form if there is nothing to show:

Private Sub Form_Open(Cancel As Integer)
If Me.Recordset.RecordCount = 0 Then
'MsgBox "No records"
Cancel = True
End If
End Sub
 
B

Bugsy

Hi Allen

Thx very much for the speedy response. Unfortunately I cannot get your
solution to work, obviously something I am not doing correctly!!! I have
created the continous form using the 'today' query with the correct criteria.
I then cancelled the open event procedure as you indicated. and saved the
form

However, when I come to open the form nothing appears to happen, and I have
ensured there are no events for today!! I copied and pasted the code that
you had supplied. Would this cause a problem??

Any ideas??

Thx again
 
B

Bugsy

Hi Allen

I gave you some duff info there!! Your solution did work but the msg box
doesn't display if there are no events!! Any ideas??
 
A

Allen Browne

Remove the single quote before MsgBox.

Anything on the line after the single quote is considered a comment. It was
intended as an example to show you how to get the MsgBox if you wanted.
(Your original post requesed showing nothing if there was nothing to show.)
 
B

Bugsy

Sorry Allen a bad explanation from me!! Thanks will give that a go. I
should have said I wanted a warning if there was an event but if nothing go
straight into the db.
 

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