473,396 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

source selection for reports- help request

I am trying to automate the way reports are printed in an Access 2003
database - I have ~200 records (people) who require between 5 and 10
customized reports (depending on values within certain fields) -
currently I print each report by selecting all employees and printing
one report at a time - once all reports are printed, I manually
collate the packages - I would like to be able to have a combo box (or
other option) highlight the required employees, press one button and
have all related reports print for the first employee, then move on to
the second employee, etc - thus each customized package will be
collated on the printer and all I have to do is add a paper clip.

I would use a combo box that displays all employees alphabetically
showing their name and employee number - once selected their employee
number (primary key) is used to select the report. I have looked at
using a macro to select the list of 10 reports, but do not have enough
experience to know how to code the procedure that will cycle through
the employee's and if they don't meet certain criteria, skip the
printing of certain reports.

I am not a programmer by any means but can generally understand code
and modify canned code to make it suit the tasks but for this project
I have not been able find a sample database that would help me
understand what I need to do.

Any help you can provide would be appreciated.

Thanks.
Jun 27 '08 #1
7 2039
On Fri, 13 Jun 2008 22:46:07 -0700 (PDT), go****@infoland.ca wrote:

I'm voting to save some trees, and email the reports overnight to the
recipients.
How to construct the code depends on the details of your db design.
Hire a competent developer to assist you with that. "Microsoft
Solution Provider" in your yellow pages may be a good place to start.

-Tom.
>I am trying to automate the way reports are printed in an Access 2003
database - I have ~200 records (people) who require between 5 and 10
customized reports (depending on values within certain fields) -
currently I print each report by selecting all employees and printing
one report at a time - once all reports are printed, I manually
collate the packages - I would like to be able to have a combo box (or
other option) highlight the required employees, press one button and
have all related reports print for the first employee, then move on to
the second employee, etc - thus each customized package will be
collated on the printer and all I have to do is add a paper clip.

I would use a combo box that displays all employees alphabetically
showing their name and employee number - once selected their employee
number (primary key) is used to select the report. I have looked at
using a macro to select the list of 10 reports, but do not have enough
experience to know how to code the procedure that will cycle through
the employee's and if they don't meet certain criteria, skip the
printing of certain reports.

I am not a programmer by any means but can generally understand code
and modify canned code to make it suit the tasks but for this project
I have not been able find a sample database that would help me
understand what I need to do.

Any help you can provide would be appreciated.

Thanks.
Jun 27 '08 #2
I know I'm not alone in looking for a solution for a task such as what
I have listed, emailing the reports is not an option as the employee
must sign the paper report... I know basically what is needed will be
like:

For Each Selected Record
Query if the employee requires the report
Print the report for the current record
Next Record

This project is not funded as I work for a government organization and
unless people want to pay more taxes to allow for larger budgets I'm
stuck trying to work through this on my own with any assistance I can
get via the web.

To reduce the resources needed to complete the tasks in my office, I
volunteer my after hours time developing things such as this database
- any useful assistance is greatly appreciated.
Jun 27 '08 #3
It's Canada, right? Let me know which government organization it is
and I'll send a cheque to the Ministry right away! I'm completely
confident that the government and its minions spend every one of my
tax dollars carefully, os if there's not enough, just let me know.

On Jun 14, 3:15*pm, goo...@infoland.ca wrote:
I know I'm not alone in looking for a solution for a task such as what
I have listed, emailing the reports is not an option as the employee
must sign the paper report... I know basically what is needed will be
like:

For Each Selected Record
Query if the employee requires the report
Print the report for the current record
Next Record

This project is not funded as I work for a government organization and
unless people want to pay more taxes to allow for larger budgets I'm
stuck trying to work through this on my own with any assistance I can
get via the web.
Jun 27 '08 #4
go****@infoland.ca wrote:
I am trying to automate the way reports are printed in an Access 2003
database - I have ~200 records (people) who require between 5 and 10
customized reports (depending on values within certain fields) -
currently I print each report by selecting all employees and printing
one report at a time - once all reports are printed, I manually
collate the packages - I would like to be able to have a combo box (or
other option) highlight the required employees, press one button and
have all related reports print for the first employee, then move on to
the second employee, etc - thus each customized package will be
collated on the printer and all I have to do is add a paper clip.

I would use a combo box that displays all employees alphabetically
showing their name and employee number - once selected their employee
number (primary key) is used to select the report. I have looked at
using a macro to select the list of 10 reports, but do not have enough
experience to know how to code the procedure that will cycle through
the employee's and if they don't meet certain criteria, skip the
printing of certain reports.

I am not a programmer by any means but can generally understand code
and modify canned code to make it suit the tasks but for this project
I have not been able find a sample database that would help me
understand what I need to do.

Any help you can provide would be appreciated.

Thanks.

I'll toss out some starter stuff. I might create a table, called
AppReports. It would have 2 fields (or more). RptID type Autonumber
and ReportDescription type text. I'd then enter your 10 reports.

I think a combo would not suit your needs. I'd use a listbox.

Since you didn't provide much information I might first create two list
boxes. The first listbox, ListEmployee, would have 2 fields, the
employeeid and the employee name. I'd set it (under data tab) to Simple
or Extended (see help for the difference by pressing F1 on that property
row).

The second listbox, ListReports, would list the Reports from table
AppReports. Set to simple or extended as well.

Then have a command button to print the reports. I don't do macros.

The event procedure for the command button might start off like this

Private Sub CommandReport_Click()
On Error GoTo Err_CommandReport_Click
Dim varEmp As Variant 'pointer to selected employees
Dim varRpt As Variant 'pointer to selected reports

Dim lngEmpID As Long 'in case you need employee id
Dim strName As String 'in case you need employee name

Dim strReport As String 'var to hold the report name

'cycle thru emp list and printing reports for
'each employee selected.
For Each varEmp In Me.ListEmployees.ItemsSelected

'1st col is EmpID, 2nd is EmpName
lngEmpID = Me.ListEmployees.Column(0, varEmp)
strName = Me.ListEmployees.Column(1, varEmp)

'cycle thru the rpts list, printing each report selected
For Each varRpt In Me.ListReports.ItemsSelected

'get each report name selected to print
strReport = Me.ListReports.Column(1, varRpt)

DoCmd.OpenReport strReport

Next varRpt
Next varEmp

Exit_CommandReport_Click:
Exit Sub

Err_CommandReport_Click:
MsgBox Err.Description
Resume Exit_CommandReport_Click

End Sub
Jun 27 '08 #5
You can build/use the "where" clause, and base the reports sql *without* any
parameters.

So, you can build a un-bound form (a un-bound form is a form that is NOT
attached to a table - these forms are typically designed for user interface
face stuff like prompts, print buttons etc).

The following screen shots are all un-bound forms, and they simply prompt
the user for information.

http://www.members.shaw.ca/AlbertKal.../ridesrpt.html

The above should give you some ideas

So, the solution use now is simply to take the values from the form, and
build your own where clause in code. That way, you simply design the reports
(or forms), and attached them to the query. And, NO FORMS conditions are
placed in the query.

To "send" the conditions to the report (or form), you simply use the "where"
clause. This is exactly why ms-access has this feature...and it solves a
zillion problems...and will reduce your development costs by a substantial
amount.

The code to make those above screens work and launch the report with the
selected restrictions when you hit the "print" button is easy:
dim strWhere as string

' select sales rep combo

if isnull(cboSalesRep) = false then

strWhere = "SalesRep = '" & cboSalesRep & "'"

end if

' select what City for the report

if isnull(cboCity) = false then
if strWhere <"" then
strWhere = strWhere " and "
endif
strWhere = strWhere & "City = '" & cobCity & "'"
end if

Note how the 2nd combo test is setup. You can add as "many" more conditions
you want. Lets say we have a check box to only include Special Customers. We
can add to our very nice prompt screen a check box to

[x] Show Only Special customers

The code we add would be:

if chkSpeicalOnly = True then
if strWhere <"" then
strWhere = strWhere " and "
endif
strWhere = strWhere & "SpecialCust = true"
endif

For sure, each combo and control we add to the nice report screen takes a
bit of code, but no more messy then the query builder..and this way, each
query is nice and clean, and free of a bunch of HIGHLY un-maintainable
forms! expressions.

Further, it means you can re-use the same query for different reports, and
have no worries about some form that is supposed to be open. So, a tiny bit
more code eliminates the messy query problem.. For me, this is very worth
while trade.

For a date range, we could put two calendar controls on the screen. The code
could be:
dim strWhere as string
dim strStartDate as string
dim strEndDate as string
strStartDtae = "#" & format(me.StartDateContorl,"mm/dd/yyyy") & "#"
strEndDate = "#" & format(me.EndDateContorl,"mm/dd/yyyy") & "#"

strWhere = "InvoiceDate is between " & strStartDate & " and " & strEndDate

docmd.openReport "InvoiceReport",acViewPreview,,strWhere
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
Jun 27 '08 #6
Thank you very much for a solution that looks like it will answer my
problem.
Jun 27 '08 #7
Thanks Albert, your solution will be ideal for dealing with an
enhancement that has been on the back burner as well. Have a great
weekend!
Jun 27 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Paul Scotchford | last post by:
Hi all, Thanks in advance to any contributions to my question. Im running SQLServer 2000 in a Win 2000 Server env. Background: ========== The database has many views that range from simple...
1
by: lawrence | last post by:
This PHP function prints out a bunch of Javascript (as you can see). This is all part of the open source weblog software of PDS (www.publicdomainsoftware.org). We had this javascript stuff...
1
by: Dalan | last post by:
I'm developing a report selection form and one of the elements of design is providing Date from/to text boxes. I have a Table that contains all of the information regarding the reports and did...
1
by: Micak | last post by:
I'm using radnom selection in ms access to select certain number of questions for the exam. i have two versions of the report: - one without marked answers - one with marked answers the problem...
2
by: Mikey | last post by:
Sample VB .NET source code to create mailing labels or customized letters using MS Word MailMerge This VB .NET source code will start MS Word and call methods and set properties in MS Word to...
3
by: jonfroehlich | last post by:
I am looking for a Visual Studio plugin or macro to manage comment headers in my .cs files (e.g., for copyright and/or open source license information). I realize that I could edit the template...
2
by: emily224 | last post by:
Hello, I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer...
4
by: emily224 | last post by:
Hello, I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer...
1
by: cwby1966 | last post by:
Hi I am trying to change the control source of a control on a report depending on a selection on the form where the report was called from. Here is the code i have tried: Private Sub...
30
by: CD Tom | last post by:
I found Stephen Lebans modReportToPDF and have been trying to get it to work in my application. I've downloaded his database and when I run his test it works fine. I then added it to my application...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.