Full Version: Open report based on query
UtterAccess Forums > Microsoft® Access > Access Forms
impala62
I have created a query qryPartsAdded showing new and revised parts.
My criteria is based on my dteAdded field in my parts form >Date()-31
Omade a report based on the query having pkPartID, txtPartNo, dteAdded, and REV fields.
ow, how do I get that report to show up only if there has been activity in the last couple of weeks when the DB opens?
Bill
dannyseager
Create a form which loads on the database load. Add to the on open event of the form
CODE
If Dcount("FieldInQuery","Queryname") > 0 then
    open report "Reportname", acviewPreview
else
end if
impala62
Issue,
I have a login form that loads first, I would like it to trigger after that form, I have a startup form as my switchboard.
Oalso get a syntax error
open report "PartsAddedRev", acviewPreview
Bill
freakazeud
Hi,
use the switchboards on load event. The complete OpenReport syntax would be:
oCmd.OpenReport "PartsAddedRev", acviewPreview
HTH
Good luck
Alan_G
Put the code Danny gave you in the On Load event of your Switchboard. The syntax is
ocmd.OpenReport "Reportname", acviewPreview
Danny was just showing you that that is the line where you'd actually open the report...........
impala62
Thanks again guys, got it working. Now if there is no activity for the 30 days will it open a blank report?
ill
dannyseager
not if your dcount() is looking at the query the report is based on... it will only open the report if there are records on it (i.e. if there are records in the query)
impala62
Thanks again.
ill
dannyseager
you're welcome
impala62
Hi again guys,
haven't tried coding this yet but could I have 2 reports open up?
I am thinking of adding a database update report for news or issues, along with my added or revised part report.
Is it just a matter of adding the same code pointing to a different report/query arrangement?
Bill
impala62
Now that I have my reports working great, I would like to add a function for level of critical say 1-5 that can be chosen,
I would like a graphical rep. as well on the report by cond. formatting.
Could I use 5 instances of the same control on the report with its separate formatting?
Any thoughts??
Bill
impala62
Not to worry,
orked out a simple solution. 1-2-3 Green-Yellow-Red conditional formatting, using combobox on form.
Bill
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.