I feel foolish for posting this question but I don't get to program often enough over the past few years to remember how to do much of anything. What I'm trying to do is to use the info in a field to run a query, which is the backbone of a report. The input table would be something like:
Date Work Order
11/1/07 123456
11/2/07 987654
I want to take the Work Order number to open a report multiple times to print info related to each Work Order. I've written the report and started the module below:
Function DoIt()
Dim WoNum As String
Dim k As String
Set rs = CurrentDb().OpenRecordset("WOs in Date Range") ' this is the table above
varValues = rs.GetRows(999)
rs.Close
intFieldCount = UBound(varValues, 1)
intRowCount = UBound(varValues, 2)
For j = 0 To intRowCount
i = 0
k = varValues(i, j)
Debug.Print k
I'm struggling to figure out how to use the value I just put in k as the criteria in the query behind the report I'm trying to print. There's probably a better way but what I think I want to do is to open the report using the first Work Order value, print it, close it, then open the same report again using the second Work Order, etc.
I'd appreciate any help I can get on this. I've wasted a couple of hours so far on this simple task.
3 1221
I feel foolish for posting this question but I don't get to program often enough over the past few years to remember how to do much of anything. What I'm trying to do is to use the info in a field to run a query, which is the backbone of a report. The input table would be something like:
Date Work Order
11/1/07 123456
11/2/07 987654
I want to take the Work Order number to open a report multiple times to print info related to each Work Order. I've written the report and started the module below:
Function DoIt()
Dim WoNum As String
Dim k As String
Set rs = CurrentDb().OpenRecordset("WOs in Date Range") ' this is the table above
varValues = rs.GetRows(999)
rs.Close
intFieldCount = UBound(varValues, 1)
intRowCount = UBound(varValues, 2)
For j = 0 To intRowCount
i = 0
k = varValues(i, j)
Debug.Print k
I'm struggling to figure out how to use the value I just put in k as the criteria in the query behind the report I'm trying to print. There's probably a better way but what I think I want to do is to open the report using the first Work Order value, print it, close it, then open the same report again using the second Work Order, etc.
I'd appreciate any help I can get on this. I've wasted a couple of hours so far on this simple task.
A bit hard to grasp what repetitive printing needs to be done per WO.
Looked like you want to print WO's with their details for a certain date-range.
This is done by defining the report for all dates and to filter the report when activated by passing the filter needed.
If that's not your problem, then please elaborate on what processing per WO is needed.
Nic;o)
A bit hard to grasp what repetitive printing needs to be done per WO.
Looked like you want to print WO's with their details for a certain date-range.
This is done by defining the report for all dates and to filter the report when activated by passing the filter needed.
If that's not your problem, then please elaborate on what processing per WO is needed.
Nic;o)
Nic,o
Thanks for your reply!
Your explanation of what I'm trying to do is right. I've had to break it down into 2 pieces because that's the only way my brain could process it. First I used a form to allow the user to enter the date range. When OK is clicked, it runs a query based on the date range and creates a table of the WOs that are within that range. Those values are what I'm putting in k above. I just can't get from that point to the criteria for the query behind the report.
It sounds like your solution above would take out the creation of the table and the need for the module. Most of what I've done in the past has been writing SQL queries so I need to study a little and see if I can figure out how to apply "a filter to a report".
I also may need to revisit why I enjoy working in ACCESS so much. I may be a little sick! : )
Again, thanks!
Shawn
These criteria (like those for a report) can be passed as the WHERE clause in the DoCmd like: -
DoCmd.OpenReport "reportname", acViewPreview, , "WHERE condition"
-
The WHERE condition looks e.g. like "StartDate between #" & Me.Startt & "# and #" & Me.End & "#"
Nic;o)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Dimension7 |
last post by:
All,
I am comparing to functions to see which is "better". In better, I mean more
efficient, optimize, faster, etc.
I have read other posts from other boards, but I'm not really sure of the...
|
by: Richard Hollenbeck |
last post by:
Hello Newsgroup. You have all been very helpful in the past and I thank
you. I try to ask relevant questions so that they don't just benefit me,
but also benefit the group. I'm currently...
|
by: censored |
last post by:
http://xchat.org/docs/plugin20.html
Good way for newbies on irc to learn the basics of language? Put it to
practical use immediately?
|
by: chellappa |
last post by:
Hi EveryBody!
How to Write c program with assembly language program , give small
example
Thank You
by
chellappa
|
by: Larry |
last post by:
I will be teaching an eCommerce application development course using
ASP.Net after many years of having taught classic ASP. (Course was
interrupted by 18 months in the Middle East with my Army...
|
by: William |
last post by:
The script below runs correctly in ASP but not ASPX. Im not sure why?
Please help.
Description: An error occurred during the compilation of a resource required
to service this request. Please...
|
by: Aris |
last post by:
A few days ago I asked from you how to join a string like "file"
A number that change values from 1 to 5 and another string like ".txt"
to have a result like "file1.txt","file2.txt" and so on
...
|
by: Bubba |
last post by:
I need to use an inline css tag for a few links that will not behave like
the a:link and a:hover attributes in my stylesheet. I want to add a special
link color with underline and a mouseover...
|
by: phanimadhav |
last post by:
hello this is sudheer,I need basics of innerjoins ...so
can any one help.please send the related link.
thanx
|
by: kadghar |
last post by:
Many people asks if there is a way to write a mathematical expression, writen as a string in a text box, so they can do something like:
sub something_click()
textbox2.text=eval(textbox1.text)...
|
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
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: 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...
|
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,...
|
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: 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...
|
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,...
| |