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

Report Manipulation

Presently I am using the following code, as the "onClick" event of a Form
Action button. What it does is print out a single report of the record that
is presently on the screen only. It works fine, it simply prints out the
record on the screen when the Form Action button is selected, without
asking any further questions.

Private Sub PrintBinLabel_()
Dim strDocName As String
Dim strWhere As String
strDocName = "RptProductionTable"
strWhere = "[LotNo] = ' " & Me! LotNo & " ' "
DoCmd.OpenReport strDocName, acViewNormal, , strWhere
End Sub

The problem that I am now facing is that the company is now using the same
"LotNo" for two or three or more runs. So now, when the Form Action button
is selected, it will print out all the lot numbers that are the same. For
example if there is three records 4121, it will print out three reports.

The company now differentiates each "LotNo" with a "LotRunNo" or a
"ProdCode". So my question is, how do I alter the above formula, using
either the "LotRunNo" or the "ProdCode", that will then print out only the
record that is on the screen.

As always, any help would be appreciated.

Bill.
--
William Bradley
Come visit us at:
http://www.catholicmissionleaflets.org
Free Rosaries available at the above.
Nov 13 '05 #1
2 1723
You need to end up with something like this:
strWhere = "([LotNo] = '" & Me! LotNo & "') AND ([ProdCode] = '" &
Me.ProdCode & "')"

Omit the extra quotes if the fields are Number, not Text.
If the fields may be blank use IsNull() to test them, and include them in
the string if appropriate.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"William Bradley" <br******@magma.ca> wrote in message
news:W8********************@magma.ca...
Presently I am using the following code, as the "onClick" event of a Form
Action button. What it does is print out a single report of the record that is presently on the screen only. It works fine, it simply prints out the
record on the screen when the Form Action button is selected, without
asking any further questions.

Private Sub PrintBinLabel_()
Dim strDocName As String
Dim strWhere As String
strDocName = "RptProductionTable"
strWhere = "[LotNo] = ' " & Me! LotNo & " ' "
DoCmd.OpenReport strDocName, acViewNormal, , strWhere
End Sub

The problem that I am now facing is that the company is now using the same
"LotNo" for two or three or more runs. So now, when the Form Action button
is selected, it will print out all the lot numbers that are the same. For
example if there is three records 4121, it will print out three reports.

The company now differentiates each "LotNo" with a "LotRunNo" or a
"ProdCode". So my question is, how do I alter the above formula, using
either the "LotRunNo" or the "ProdCode", that will then print out only the
record that is on the screen.

As always, any help would be appreciated.

Bill.
--
William Bradley
Come visit us at:
http://www.catholicmissionleaflets.org
Free Rosaries available at the above.

Nov 13 '05 #2
Allen Browne wrote:

Thanks Allen, I will give it a try.

Bill.
You need to end up with something like this:
strWhere = "([LotNo] = '" & Me! LotNo & "') AND ([ProdCode] = '" &
Me.ProdCode & "')"

Omit the extra quotes if the fields are Number, not Text.
If the fields may be blank use IsNull() to test them, and include them in
the string if appropriate.


--
William Bradley
Come visit us at:
http://www.catholicmissionleaflets.org
Free Rosaries available at the above.
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: mir nazim | last post by:
hi, i wanted 2 know if there is any report generator for python/linux that produces reports in variety of formats e.g html/images/jpeg/png etc. i know about report lab but output is pdf. pdf is...
24
by: Michael Malinsky | last post by:
I'm attempting to create a database which will take information from one (perhaps two) tables and utilize that information to return queries to a report designed in Excel. The general idea I...
4
by: Gerry Abbott | last post by:
Hi All, I have a three dimensional array holding data generated from manipulation of a recordset. This is done in a form, but could be done in the report at start up. Is there a way I can use...
5
by: johnp | last post by:
Hello Everyone, Someone asked me today if it was possible to update data in a table via a report. I saw one thread where someone indicated the solutions.mdb had a report that did it but I...
1
by: verb13 | last post by:
I have 2 text fields in a report coming from a recordset. I want to have a third field which will contain the result of some complex string manipulation of the 2 fields. How can I achieve this? The...
1
by: Louly | last post by:
Create a form to enter report criteria? Anyone can help me with this? I don't want to do it using the Macros method. Is there a way to do it using VBA? Thanks for your cooperation. Louly
0
by: L'eau Prosper Research | last post by:
Press Release: L'eau Prosper Research (Website: http://www.leauprosper.com) releases new TradeStation 8 Add-on - L'eau Prosper Market Manipulation Profiling Tools Set. L'eau Prosper Market...
0
by: L'eau Prosper Research | last post by:
NEW TradeStation 8 Add-on - L'eau Prosper Market Manipulation Profiling Tools Set By L'eau Prosper Research Press Release: L'eau Prosper Research (Website: http://www.leauprosper.com) releases...
2
by: cephal0n | last post by:
I need big hand of help coz I'm stuck in a huge puddle of access mess I made. I need to view my query in a report, I know it's easy for access because it provides a custom made report and you need...
2
by: passterelli | last post by:
I have created a report that displays the contents of large memo fields. The report must be exported to MS Word (or .rtf) so the type style and type size can be modified according to the final user's...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.