473,398 Members | 2,125 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,398 software developers and data experts.

Need help with the basics

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.
Oct 29 '07 #1
3 1221
nico5038
3,080 Expert 2GB
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)
Oct 30 '07 #2
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
Nov 2 '07 #3
nico5038
3,080 Expert 2GB
These criteria (like those for a report) can be passed as the WHERE clause in the DoCmd like:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "reportname", acViewPreview, , "WHERE  condition"
  2.  
The WHERE condition looks e.g. like "StartDate between #" & Me.Startt & "# and #" & Me.End & "#"

Nic;o)
Nov 2 '07 #4

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

Similar topics

11
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...
1
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...
1
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?
2
by: chellappa | last post by:
Hi EveryBody! How to Write c program with assembly language program , give small example Thank You by chellappa
11
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...
2
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...
10
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 ...
5
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...
1
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
2
kadghar
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)...
0
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
0
BarryA
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...
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...
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...
0
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
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,...

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.