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

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 NewRepairPrintPreview_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.OpenReport 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 1836
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.googleg roups.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**********@gmail.com> wrote in message
news:e7**************************@posting.google.c om...
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 NewRepairPrintPreview_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.OpenReport 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
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...
4
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...
2
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...
3
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...
3
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...
4
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
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...
12
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...
10
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. ...
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: 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
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...
1
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
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...
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.