Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running a query on startup and displaying msgbox

Status
Not open for further replies.

djjay

Technical User
Jul 12, 2005
11
GB
hi.

I've got a table in my db which is called ProjectBookings. The table holds details of different projects booked for this company, with the following main fields:

ProjectID
BookingReceived
ClientID
InvoiceSubmitBy
InvoicedYesNo

there are other fields but these are the main ones. The way the system works is that projects are booked in and then when they are invoiced the [InvoicedYesNo] field is set to yes.

The [InvoiceYesNo] field holds the date that the client must be invoiced by in order to received payment. I need a query that runs automatically on startup and checks the [InvoiceSubmitBy] date and the [InvoicedYesNo] fields and if the invoice has not been issued and the submitby date is 5 or less days from today then i need a message box to popup and warn that invoices need to be issued and then show the projects needing invoicing.

Any ideas how i could do this?

 
Create this query

Select ProjectID, BookingReceived, ClientID, InvoiceSubmitBy, InvoicedYesNo
From ProjectBookings
Where ((InvoiceSubmitBy < Date()-5) And (InvoicedYesNo = False));

and name it qdfCheckInvoices

Create in a module this sub

Sub CheckTheInvoices

If DCount ("ProjectID", "qdfCheckInvoices")>0 then
MsgBox "Invoices need to be issued"
DoCmd.OpenQuery "qdfCheckInvoices"
End If
End Sub

When your switchboard loads call that sub!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top