473,378 Members | 1,175 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,378 software developers and data experts.

Creating report with dynamic queries

68
Hi Help needed here.

I have a table for storing logs of maintenance work done on systems in my organization.

I would like to create a report that would be able to auto generate different queries based on parameters entered by a user. for example, lets say that the user wants to know what technican X did for the week. he would open the report and have a form popup before him that allows him to enter technican X name and the date range.

in reality when he enter these names they must be placed in a query with the and/or and execuited so as to produced the desired report.

Is this possible in Access.
Feb 12 '08 #1
3 1595
puppydogbuddy
1,923 Expert 1GB
Hi Help needed here.

I have a table for storing logs of maintenance work done on systems in my organization.

I would like to create a report that would be able to auto generate different queries based on parameters entered by a user. for example, lets say that the user wants to know what technican X did for the week. he would open the report and have a form popup before him that allows him to enter technican X name and the date range.

in reality when he enter these names they must be placed in a query with the and/or and execuited so as to produced the desired report.

Is this possible in Access.
Yes, you can create a parameter form and reference that form in the query that is the record source for your report. Page down until you come to the topic "Creating a form to supply parameters to a report" at the following link:

http://office.microsoft.com/en-us/ac...170771033.aspx
Feb 12 '08 #2
KingKen
68
Yes, you can create a parameter form and reference that form in the query that is the record source for your report. Page down until you come to the topic "Creating a form to supply parameters to a report" at the following link:

http://office.microsoft.com/en-us/ac...170771033.aspx
I followed the instructions on the site and got through to a point but it doesnt work completely. I created a form with the following fields: department, serviced by, Reported by, ProductID product model, date started and date completed. I set up this form so that it can pass this info to a querry after being called by a report. the query is as follows:
Expand|Select|Wrap|Line Numbers
  1. SELECT [Maintenance History].HardwareAssetID, [Maintenance History].LocationOfficer, Departments.DeptName, [Hardware Assets].[Model#], [Hardware Assets].[Serial#], [Maintenance History].DateReported, [Maintenance History].PerformedBy, [Maintenance History].ProblemDescription, [Maintenance History].Cause, [Maintenance History].SolutionDescription, [Maintenance History].DateCompleted
  2. FROM Departments INNER JOIN ([Hardware Assets] INNER JOIN [Maintenance History] ON [Hardware Assets].HardwareAssetID = [Maintenance History].HardwareAssetID) ON Departments.DeptCode = [Hardware Assets].DepartmentCode
  3. WHERE ((([Maintenance History].HardwareAssetID)=[Forms]![Hardware Support Loga Querry Parameters]![HardwareID])) OR ((([Maintenance History].LocationOfficer)=[Forms]![Hardware Support Loga Querry Parameters]![ReportedBy])) OR (((Departments.DeptName)=[Forms]![Hardware Support Loga Querry Parameters]![Department])) OR ((([Hardware Assets].[Model#])=[Forms]![Hardware Support Loga Querry Parameters]![Combo18])) OR ((([Hardware Assets].[Serial#])=[Forms]![Hardware Support Loga Querry Parameters]![Serial#])) OR ((([Maintenance History].DateReported)=[Forms]![Hardware Support Loga Querry Parameters]![DateReported])) OR ((([Maintenance History].PerformedBy)=[Forms]![Hardware Support Loga Querry Parameters]![ServicedBy])) OR ((([Maintenance History].DateCompleted)=[Forms]![Hardware Support Loga Querry Parameters]![DateCompleted]));
  4.  
  5.  
Sorry about the length... but you can disreguard the unnecessary

I want to be able to enter the product ID and be able to get the service history of that product, or if i enter the technican name then i would get all the work done by that technican. The same way if i enter the the technican name and the product ID, i must be able to acquire all the work done on that product by that technican.

What else if anything must i do to accomplish this or what have I been doing wrong?
Thanks

PS I am working in office 2003
Feb 18 '08 #3
puppydogbuddy
1,923 Expert 1GB
I followed the instructions on the site and got through to a point but it doesnt work completely. I created a form with the following fields: department, serviced by, Reported by, ProductID product model, date started and date completed. I set up this form so that it can pass this info to a querry after being called by a report. the query is as follows:

SELECT [Maintenance History].HardwareAssetID, [Maintenance History].LocationOfficer, Departments.DeptName, [Hardware Assets].[Model#], [Hardware Assets].[Serial#], [Maintenance History].DateReported, [Maintenance History].PerformedBy, [Maintenance History].ProblemDescription, [Maintenance History].Cause, [Maintenance History].SolutionDescription, [Maintenance History].DateCompleted
FROM Departments INNER JOIN ([Hardware Assets] INNER JOIN [Maintenance History] ON [Hardware Assets].HardwareAssetID = [Maintenance History].HardwareAssetID) ON Departments.DeptCode = [Hardware Assets].DepartmentCode
WHERE ((([Maintenance History].HardwareAssetID)=[Forms]![Hardware Support Loga Querry Parameters]![HardwareID])) OR ((([Maintenance History].LocationOfficer)=[Forms]![Hardware Support Loga Querry Parameters]![ReportedBy])) OR (((Departments.DeptName)=[Forms]![Hardware Support Loga Querry Parameters]![Department])) OR ((([Hardware Assets].[Model#])=[Forms]![Hardware Support Loga Querry Parameters]![Combo18])) OR ((([Hardware Assets].[Serial#])=[Forms]![Hardware Support Loga Querry Parameters]![Serial#])) OR ((([Maintenance History].DateReported)=[Forms]![Hardware Support Loga Querry Parameters]![DateReported])) OR ((([Maintenance History].PerformedBy)=[Forms]![Hardware Support Loga Querry Parameters]![ServicedBy])) OR ((([Maintenance History].DateCompleted)=[Forms]![Hardware Support Loga Querry Parameters]![DateCompleted]));


Sorry about the length... but you can disreguard the unnecessary

I want to be able to enter the product ID and be able to get the service history of that product, or if i enter the technican name then i would get all the work done by that technican. The same way if i enter the the technican name and the product ID, i must be able to acquire all the work done on that product by that technican.

What else if anything must i do to accomplish this or what have I been doing wrong?
Thanks

PS I am working in office 2003
There are several possibilities.
1. You have 2 criteria, with technician name an "optional" criteria that may or may not be used, so you have to handle this in the reference to the form parameters in the query grid. try entering the criteria this way in the criteria row of your query. I don't know if it will work, but I am trying to substitute a wildcard for a null if you only enter the productId. If chr(42) does not work, try using "*" instead. Replace the illustrative object names I used with their actual names.
................ProductID......................... .........TechName
Forms!YourForm!YourControl............NZ(Forms!You rForm!YourControl,Chr(42))

2. Be sure your form stays open until he query/report is finished.
Feb 18 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Gary | last post by:
I am working with a report generator that is based on SQL Server 2000 and uses ASP as the UI. Basically we have a set of reports that end users can execute through a web browser. In general the...
2
by: Andrea | last post by:
I'm having some difficulty creating a report in Access and I need some suggestions. My company issues "Return Authorizations" when customers need to return products. A customer calls in and we...
1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
1
by: longtim | last post by:
I have been having endless difficulty creating reports/queries that set any relevent parameters from controls in forms. I am creating an application under access 2003 but will target access...
1
by: CrystalDBA | last post by:
I usually design applications in SQL Server and Crystal Reports. I now need to create a crystal report on an MS Access database. I have two tables: Services: Date datetime Entry text...
44
by: Greg Strong | last post by:
Hello All, Is it better to create a query in DAO where a report has 4 sub-reports each of whose record source is a query created at runtime and everything is in 1 MDB file? From what I've...
4
by: jason.teen | last post by:
Hi, I am trying to create a table of Query "Metrics" ie. I have many tables in a database which most of the time just counts the number of rows in a certain table, or the number of distinct rows...
3
by: wsox66 | last post by:
I am new to Access and need some help building a report. I have looked through previous posts on reports but none of them seem to answer my question completely. I am using Access 2003 and I have...
3
by: Brett Barry: Go Get Geek! | last post by:
Hello, I just started using Access 2007 after using Access 2003 for a long time. I've created all my queries and they work fine. However, either I forgot or it has changed but, how do I create a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.