473,509 Members | 3,095 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using different reports for different lines of the same query

4 New Member
Hi all.

In my company we have a database to keep record of measuring and control instruments f.e. Pressure switchs, Thermometres, Gauges, etc.

Each type of instrument has a different form because the type of data we keep from them varies depending of how it works. Al these forms have a common part where we put the name of the instrument, the facility, serial number, etc. and a different one with the especific technical data for each instrument. We have a corresponding report for each type of form.

To enter data for a new instrument it's easy, the user just selects the type and then he is showed the right form.

The problem is when I want to print all the instruments data from a certain installation, for example. The query will give me as a result many different instruments. When I print the reports I need to launch a different one depending of the instrument type and here is where I need your help.

How to lauch different reports from a single query depending on the intrument type?

If I didn't explain correctly please let me know and I will try to make it clearer. As you surely have seen english is not my first language. :)

Thanks in advance.
Apr 30 '12 #1
6 1429
NeoPa
32,557 Recognized Expert Moderator MVP
You seem to make fewer errors in your English than many for whom it IS their first language :-D

You do, however, have a pretty complex task in front of you. My advice would be to try to design a report with various controls available. Some fairly complex (although not rocket-science level) code would need to be run at print or format time to ensure that only the controls appropriate for the current object are visible.

Another thought that occurs to me, although I can't promise it will work as it's just a new idea, is to have a subreport control that takes any of the reports designed for your objects and sets the ObjectSource value of the SubReport control to match for each individual object.
Apr 30 '12 #2
Mihail
759 Contributor
Lets see first if I understand well your request:
Expand|Select|Wrap|Line Numbers
  1. For Each Instrument In Query Instruments
  2.     Print the report
  3. Next
Is this what you are looking for ?

If the answer is YES I think that is an easy task:
Also in pseudo-code that must look like:
Expand|Select|Wrap|Line Numbers
  1. Create a recordset based on your query
  2. For Each record in recordset
  3.     Select Case InstrumentType
  4.         Case Thermometre
  5.             DoCmd OpenReportForTermometres Filter:= ThermometreIdentifier
  6.         Case PresureInstrument
  7.             DoCmd OpenReportForPresureInstruments Filter:= PresureInstrumentIdentifier
  8.         Case .........
  9.              DoCmd OpenReport....... Filter:= ...........Identifier
  10.         Case Else
  11.              Some error message
  12.     End Select
  13. Next
May 1 '12 #3
David Scott
4 New Member
Thank you both for your answers.

I think that what I need is exactly what Mihail says, a Select Case that goes through all the instruments launching the right report depending on its type.

The problem is that I'm having trouble implementing it and as I still have very little experience with VBA and SQL I can't find the error.

From what I've found googling this is the way to create a recordset from my query:

Expand|Select|Wrap|Line Numbers
  1. Dim dbCalibraciones As DAO.Database
  2. Dim rstEquipos As DAO.Recordset
  3. Dim strSQL As String
  4.  
  5. Set dbCalibraciones = CurrentDb
  6. Set rstEquipos = dbCalibraciones.OpenRecordset(CON_FICHAS_BLANCO)
CON_FICHAS_BLANCO is a query that gives me all the instruments from a selected facility.

This returns me the error 3061 saying that they are too few parameters and that 1 was expected.

What i am doing wrong?

Thank you very much for your patience.
May 2 '12 #4
NeoPa
32,557 Recognized Expert Moderator MVP
That may certainly prove an easier approach to get your head around David. I'll continue to follow anyway, in case I can be of further help.
May 2 '12 #5
Mihail
759 Contributor
Sorry but this time my time is very limited.
Try to put CON_FICHAS_BLANCO between quotes:

"CON_FICHAS_BLANCO"

If steel don't work inform me and I'll try, tomorrow, to give you more assistance.
May 2 '12 #6
NeoPa
32,557 Recognized Expert Moderator MVP
Mihail:
Try to put CON_FICHAS_BLANCO between quotes:
That would certainly be necessary David. Otherwise VBA will be looking for a variable called CON_FICHAS_BLANCO.
May 3 '12 #7

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

Similar topics

2
2303
by: Luis Serrano | last post by:
Hi all, I'm trying to generate labels to print in several different formats, all of them with their own height,width and page margins. We've got this done in MS Access 2000, using a designed...
0
1010
by: lra | last post by:
I am exporting my report to an html file using Crystal Reports. I have set the following properties: htmlOpts.HTMLBaseFolderName = @"C:\Temp\"; htmlOpts.HTMLFileName = "MyTest.html"; My file...
1
1357
by: Don Wash | last post by:
Hi All! I'm very very new to DotNet and doing my first Report project. I'm planning of using VS.NET built-in CrystalReports to create reports. I'm probably really navie and ignorant to ask this...
0
873
by: Enver A | last post by:
Hi There, I am having difficulties on using Active Reports on vb.net . I have succesfully tried and executed designing and printing a report but what i am trying to do is to design an End-User...
0
854
by: mafandon | last post by:
In my windows application, I have a few different reports that are custom. We print the reports to pre-formatted carbon paper. I would like to set the printer for each report so the user doesn't...
1
5834
by: Venk | last post by:
I want to combine 2 different reports. That is Report 1 should be followed by report 2 If Report 1 is in Page 1, automatically report2 should be in page2 Any thought or help on this would be...
1
2254
by: krupas | last post by:
Hi, I have an ASP.net site in which I am generating reports using Crystal reports for .Net framework 2.0. I want to know if it is possible to change the format of the x axis data values. For...
0
882
by: kalpanasuresh | last post by:
Hi, I am getting Logon error while using Crstal Reports in ASP.net.pls help Thanks in advance
4
2902
by: GladGad | last post by:
I am not a real well versed query writer and therefore am having some problems figuring out how to write a parameter query where I want to input a partial name. I have tried a few different things,...
4
4422
by: kv29 | last post by:
Hi everyone! I really hope my problem will be a piece of cake for an expert coder :) I have a table with 100 records, and I need to print them all between 10 different reports based on each...
0
7344
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7412
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7069
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
5652
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,...
1
5060
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4730
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3203
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1570
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
775
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.