Automatic Report

  • Thread starter Thread starter Forrest Frey
  • Start date Start date
F

Forrest Frey

I am currently working on a call log database for my IT
department. I have the table built, and it looks like
this:

ID - Primary Key auto number
Date - Date/Time
Caller - Text
Workstation - Text
Problem - Memo
AssignedTo - Text
Resolved -yes/no
Resolution - Memo

I am looking to create a report based on unresolved
problems. I have built the query that looks like this:

ID
Date
Caller
Workstation
Problem
AssignedTo
Resolved = no

This works fine, but I am looking to tweak it a little
more.

What I am looking for is when Access opens I want the
query to run, and if there are any unresolved problems I
would like to get a message box saying that, "There are
unresolved Problems would you like to print a report?"
And of course I would want the yes no buttons.

Any help would be greatly appreciated.
 
Create a little function like this and run it from an auto exec macro:

Public Sub CheckProbs()

Dim rsProblems as ADODB.Recordset
Dim conn as ADODB.Connection

Set conn = Current Project.Connection
Set rsProblems = New ADODB.Recordset
rsProblems.Open "NameOfYourQueryHere", Conn, adOpenForwardOnly,
adLockReadOnly
If rsProblems.EOF = False Then
If MsgBox ("There are outstanding problems, do you want to view the
report?", _
vbYesNo + vbQuestion) = vbYes Then
Docmd.OpenReport "ProblemReport", acViewPreview
End if
End if
rsProblems.Close
End Sub
 
Back
Top