473,657 Members | 2,727 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

parameter query with simple outputs achieved but require a multi-field output.

5 New Member
Hi.
I'm new to this database world. Just started Access training a few months ago and have a somewhat complicated database already built. In a nutshell, I have a select query that uses a parameter callout so the user can enter a serial number of a widget and get test information for a report. The query pops out the test data in, for simplicity, in two columns, rest result Type A and Type B. The challenge for me is getting the results broken down into more columns. See, Type A testing is taken several times at different stages followed by Type B, the again followed by more Type A tests. The conditions of A and B tests are distinguished by TypeAID and TypeBID autonumbers which I can relate to operators, machines and conditions.

The other variation in the data is that widget 1 might have 2 As followed by 2 Bs then 1 A test as the norm. But occasionally, there is a need to retest so some widgets will have multiples of any of the Tests. Also, each test A and B are done in triplicate or more depending on the widget part number and all need to be reported.

For a single parameter entry of a SN, I'd like to be able to make a report that lists all these data in one column for each test condition and left to right by date. How is this type of operation done? Are there any special techniques I need to learn like macos or SQL code to get this done so its simple for the user? THANKS for any guidance. I hope I was clear enough to get a meaningful response.

TonyJH
Mar 2 '07 #1
5 1774
nico5038
3,080 Recognized Expert Specialist
Not exactly sure what your problem is.
Looks to me that when you have a "TestID" and a date/timestamp for the TypeA end TypeB tests, you can report all needed. (I assume the same widget can be tested in several occasions, thus the "TestID" that identifies a single testrun)

The only problem will be the reporting on a single line.
As you'll probably not able to control the number of tests on one day, it's hard to impossible to know howmany fields are needed...
Personally I prefer to report as much as possible on separate lines.
The alternative would be to create a query with a sequencenumber per day and use that in a crosstable query to get multiple columns. This requires however a max number of tests per day and VBA coding :-(

Nic;o)
Mar 3 '07 #2
TonyJH
5 New Member
Thanks for your response.

Most of the time, testing is only done once a day but where multiple testing is likely, I would use time of day also. I think a maximum number of columns might be an acceptable way to go about accomplishing this task.

Now, what's the best way to learn about VBA coding that I'm apparently going to need to use to make this happen? I need to learn this fast or perhaps be able to "buy" a consultant's time to complete this job. Is there a "VBA code for Dummies" self-help out there that you can suggest for neophytes like myself?
Mar 3 '07 #3
nico5038
3,080 Recognized Expert Specialist
Here's some code I use myself for filling a report from a crosstable query:

Making the columnheader and detaildata flexible needs some VBA code in the OpenReport event.

To start, doing this you need to place the fields "coded" in the report.
The column headings should be called "lblCol1", "lblCol2", "lblCol3", etc.
The "detail" fields should be called "Col1", "Col2", "Col3", etc.

The report query has two rowheader columns and a Total column, therefor the first field is effectively column 4 (count starts at 0 so I used intI=3) but this could differ for you.

Make sure that the number of Columns is not bigger as the number placed. The programcode has no protection against that !

The OpenReport code:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_Open(Cancel As Integer)
  2. Dim intI As Integer
  3.  
  4. Dim rs As Recordset
  5.  
  6. Set rs = CurrentDb.OpenRecordset(Me.RecordSource)
  7.  
  8. 'Place headers
  9. For intI = 3 To rs.Fields.Count - 1
  10. Me("lblCol" & intI - 1).Caption = rs.Fields(intI).Name
  11. Next intI
  12.  
  13. 'Place correct controlsource
  14. For intI = 3 To rs.Fields.Count - 1
  15. Me("Col" & intI - 1).ControlSource = rs.Fields(intI).Name
  16. Next intI
  17.  
  18. End Sub
  19.  
The report query has two rowheader columns and a Total column, therefor the first field is effectively column 4 (count starts at 0 so I used intI=3) but it could differ for you.

Finally you'll need to create a crosstable query based on another query that will count the number of entries per date.
To do that use the DCOUNT() function like:
select dcount("*","tbl X","datefieldna me=#" & [datefieldname] & "# and ID<=" & ID) as SequenceNumber, .....
The ID needs to be replace with the unique key of your table.

Take your time to grasp this and let me know when and where you get stuck.

Nic;o)
Mar 3 '07 #4
TonyJH
5 New Member
Thanks for your reply, Nico.

I will study your last response and try to implement a solution to the problem I posed. I'll assure you I'll get back to you when I need more help. Meanwhile, is there a VBA for Dummies or equivalent that will catapult me to more understanding in writing or understanding this code? Perhaps that has been asked in previous messages. I'll search the archives. If someone finds it, please let me know.

Thanks again.

Tony
Mar 4 '07 #5
nico5038
3,080 Recognized Expert Specialist
Almost any book on VBA will do, but checking out the samples on sites (like www.mvps.org/access are also a good way to start.
Finally the Access programmers guide that comes with Access and/or the Help file (press F1) are also a valuable source.

Success !

Nic;o)
Mar 4 '07 #6

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

Similar topics

3
16940
by: WGW | last post by:
Though I am a novice to MS SQL server (2000 I believe), I can do almost! everything I need. Maybe not efficiently, but usefully. However, I have a problem -- a complex query problem... I can create a parameter query in a stored procedure, but how do I use the result set of a parameter query in a select query (in the same or another sp)? In short, if a select query contains a result table that is generated as a parameter query, how do I...
0
1724
by: VictorCorey | last post by:
Is it possible to use a multi-parameter query in .NET Here's the method Public Function SearchCatalog(ByVal searchString As String, ByVal allWords As String) As OleDbDataReade ' Create the connection objec Dim connection As New OleDbConnection(connectionString Dim command As New OleDbComman ' We guard agains bogus values here - if we receive anythin
10
125446
by: Resant | last post by:
I have a query : Exec 'Select * From Receiving Where Code In (' + @pCode + ')' @pCode will contain more than one string parameter, eg : A1, A2, A3 How can i write that parameters, I try use : set @pCode='A1','A2','A3' but get an error : Incorrect syntax near ','
2
4157
by: Christine | last post by:
I am struggling to learn to use Access almost on my own, and have written a query that needs to have a parameter. The query I wrote includes in the Criteria of the design view, under the column that would contain the Facility Code. When I run the query, the 'enter parameter value' box comes up twice, rquiring the parameter to be entered twice before the information is displayed. I hope I'm explaining this correctly. Can someone direct me...
1
2134
by: Steven C | last post by:
Hi, I'm sure there is a really simple way to do this... I'm trying to pass an input paramater to an Access query using OleDb. I know it can be achieved using a command object but this only seems to be able to create a datareader object and I want a dataset. Does any one know how to pass an input paramateter to get a dataset back? Thanks in advance Steven
10
2367
by: serge calderara | last post by:
Dear all, I need to build a web application which will contains articles (long or short) I was wondering on what is the correct way to retrive those article on web page. In orther words, when there is such information to be displayed are they coming from imported files, database ? Where and how this type of information is stored ? What is the way to retrieve such information in order to display it in page ?
0
2179
by: Billie Boy | last post by:
Hi to all. I’m new here and am coming to you from Melbourne Australia. So a big HELLO 2 ALL. Now I am encountering an annoying problem in the SQL builder of the copy of VB.6 that I am using at home. My problem is that it’s driving me NUTS NUTS NUTS. I am connected to a data connection within my computer that accesses tables & views from a MS Access file.
4
3179
by: Andy_Khosravi | last post by:
I'm trying to build a search utility for users to find 'inquiries' in my database that involves several tables. This is normally easy to do with the query builder, but I have a unique situation involving a multi select listbox. Unfortunatly, my SQL skills are somewhat limited, so I'm not sure if there is an easy way around it. To simplify the explanation, I'll simplify the table/field setup to get at the meat of the question. I have a...
2
9441
by: angie | last post by:
I need to figure out how to create a user interface to search a query, but here's the bad part...I need to account for criteria on at least 7 of the fields. Here's what I'm thinking I need to do: Create an unbound form with unbound fields for all 7 of the fields in the query. Then in the query create parameters that refer to those fields. But it's not that simple because the user needs the flexibility of filling in as many or as few...
1
7319
by: TonyJH | last post by:
Hello, I have a database in Access2003. I have set up several queries that use the parameter entry . Each query produces different outputs from various tables that go into a report. Sometimes, a report calls for more than one query using the same serial number. Is there a way to not require the operator to input that same parameter for every query short of building a hugh query for all the data for that report? For a group of queries, I...
0
8394
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8306
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7327
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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 we have to send another system
2
1955
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.