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

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

5
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 1765
nico5038
3,080 Expert 2GB
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
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 Expert 2GB
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("*","tblX","datefieldname=#" & [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
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 Expert 2GB
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
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...
0
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...
10
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 :...
2
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...
1
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...
10
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...
0
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...
4
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...
2
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:...
1
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...
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$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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...

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.