473,626 Members | 3,231 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Print Form to Report

Hi,

I'm a DB newbie and I've been having issues trying to print the record
I am viewing in a form to a report. I have looked in groups all over
and they all say to try basically the same thing but I can't get it to
work.

This is the latest code I've tried:

Private Sub NewRepairPrintP review_Click()

If Me.Dirty Then
Me.Dirty = False
End If

Dim strReportName As String
strReportName = "Print New Repair"
Dim strCriteria As String

If Me.NewRecord Then
MsgBox "There is no record to print..."
Else
strCriteria = "[Cust#] = " & Me.[Cust#]
DoCmd.OpenRepor t strReportName, acViewPreview, , strCriteria
End If

End Sub

Using Access2000, the form is filtered to show only one record. When I
click the command button it comes up with the message box Enter
Parameter Value for Cust#, which I enter, but the report still shows
all of the records.

The report is currently sourced from the table, but when it was from a
query that didn't make any difference either.

Does anyone know what I'm doing wrong??
Nov 13 '05 #1
3 1850
this is happening because it can't find the [cust#] so it is asking
for teh data. the Me.[Cust#] what is that. if it is a text box (like
a bound box to a column of the database) you might need to Cust#.Value
which will return the value of teh box. the only other thing i can
think of is the #. i will assume that is an abreviation but if it
isn't rename that so that there is no # sign.

that's all i can think of off the top of my head. hope this might help
some.

Nov 13 '05 #2
cv******@yahoo. com wrote in message news:<11******* *************** @o13g2000cwo.go oglegroups.com> ...
this is happening because it can't find the [cust#] so it is asking
for teh data. the Me.[Cust#] what is that. if it is a text box (like
a bound box to a column of the database) you might need to Cust#.Value
which will return the value of teh box. the only other thing i can
think of is the #. i will assume that is an abreviation but if it
isn't rename that so that there is no # sign.

that's all i can think of off the top of my head. hope this might help
some.


Hey I renamed cust# and tried adding .value but neither has seemed to
work, the box asking for the parameter still comes up. Adding the
..value just seems to have changed the custID on the report so that
they are all whatever number i entered as the parameter...

Also when I have tried giving more info about which field to use, ie.
Form![FormName]![Field] it tells me that it can't find the field.

This is so frustating, it's the last thing I need to do and I just
can't seem to get it.
Nov 13 '05 #3
Your code looks OK. You don't say if your form and report use the same
record source; if not, make sure that [cust#] is in both record sources.
Beyond that, you could ensure that both the form and report have bound
controls to [cust#] and that the controls are also named [cust#] (you can
make both controls invisible once you get it working). Also check the
report's group/sort property to correct any naming errors.
-Ed

"Simone" <se**********@g mail.com> wrote in message
news:e7******** *************** ***@posting.goo gle.com...
Hi,

I'm a DB newbie and I've been having issues trying to print the record
I am viewing in a form to a report. I have looked in groups all over
and they all say to try basically the same thing but I can't get it to
work.

This is the latest code I've tried:

Private Sub NewRepairPrintP review_Click()

If Me.Dirty Then
Me.Dirty = False
End If

Dim strReportName As String
strReportName = "Print New Repair"
Dim strCriteria As String

If Me.NewRecord Then
MsgBox "There is no record to print..."
Else
strCriteria = "[Cust#] = " & Me.[Cust#]
DoCmd.OpenRepor t strReportName, acViewPreview, , strCriteria
End If

End Sub

Using Access2000, the form is filtered to show only one record. When I
click the command button it comes up with the message box Enter
Parameter Value for Cust#, which I enter, but the report still shows
all of the records.

The report is currently sourced from the table, but when it was from a
query that didn't make any difference either.

Does anyone know what I'm doing wrong??

Nov 13 '05 #4

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

Similar topics

7
14358
by: Pat | last post by:
I would like to send the Print Preview of a MS Access form to a Snapshot file. The form contains an OLE graph. BACKGROUND A snapshot of a report is possible. If I could I would use a report to display the graph but it is not possible to send query parameters to an OLE graph on a report (or programatically change any properties of an OLE Graph). However with a Form you do have the ability to change the RowSource of
4
2402
by: Jan | last post by:
I am having problems trying to print a report based on a form. This is a search form only, no data input. There is a query that the form looks at, but then there are numerous comboxes that you can pick information from either one or many and press a search button. See code below for the "Case Select" that was used to make up the comboboxes. Not a filtered list. My problem is that when I try to print, it prints all records before the...
2
3579
by: Paul Mendez | last post by:
I have a form that consists of 150 records and is still growing. there are times when I want to print a certain record of the form, say record 12. I go to file --> print and choose the page number of the record. But what I would like to do, to decrease the amount of mistakes of print all 150+ records, I would like a button to only print the record that is currently displayed on screen. I know it can be done, I just don't know how. Any...
3
7021
by: TDIOwa | last post by:
I have a report printing form (Access 97) in which I print different reports from. I have added a combo box that selects the number of copies that I want to print. Here is the rub... The following is the syntax that I use. The only problem is that I have the Database window hidden at all times and when I hit the print command button the report prints but the Database window becomes visible. DoCmd.SelectObject acReport,...
3
11862
by: sea | last post by:
I need to be able to print the current form because the form has an embedded object of a .gif file, so report will not work -- does anyone know the way to do this? I tried some code, not sure what it was now, guess docmd.printout or something but that prints ALL the forms -- also the each page of the form does not always start at the next page even if allowcontinuousforms is set to no. The preview button previews all the forms as well,...
4
8743
by: Deano | last post by:
I'm in the situation of having to print a form - not a report. This will fit nicely in a landscape format but by default it prints portrait. Is there any code to make it play nice?
6
9410
by: Dave | last post by:
On my form I have combo boxes. These combo boxes, after updating them, populate respective listboxes that are located below the combo boxes on the same form. I am trying to use a "generate report" button located on my form to print all of the list box values (that have been updated via selection from combo boxes) from the form to the report. I've tried using a macro with the code: Macro Name: cmdGenerateReport : On Click Action:...
12
3527
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to print the report three times, but do not know how
10
9115
by: Snoopy33 | last post by:
I have a DB that I developed on access XP (2002) and deployed over a year ago. No one has had problems printing any of the reports within the DB until we started loading 2007 on new computers. The access 2007 users cannot print one of the reports. This is maddening since I cannot duplicate the issue on any computer that runs 2003 or below. Is there something going on that I'm not seeing? Does anyone have any suggestions at all on...
0
8269
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
8203
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
8711
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...
0
8642
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8512
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
7203
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...
1
2630
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
1
1815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1515
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.