473,938 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Filter Report to Only Print Current Record from Form


I am new to MS Access. I have created a simple entry form to track
patient information. I have also created a Patient Report that prints
Patient Information with a standard disclaimer statement. I added a
print button to my entry form hoping that the patient information that I
enter will merge with the Patient Report however I must be missing a
step because when I click on the print button it prints all patients in
the database. Is there a way to filter the report so that it will only
print the current patient?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #1
3 16840
On 30 Dec 2004 16:15:28 -0600, Glenn Zamora wrote:
I am new to MS Access. I have created a simple entry form to track
patient information. I have also created a Patient Report that prints
Patient Information with a standard disclaimer statement. I added a
print button to my entry form hoping that the patient information that I
enter will merge with the Patient Report however I must be missing a
step because when I click on the print button it prints all patients in
the database. Is there a way to filter the report so that it will only
print the current patient?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Every patient has his/her own unique ID, correct?
Code the print button's click event:
DoCmd.OpenRepor t "ReportName",ac ViewPreview, , "[ID] = " & Me![ID]

The above assumes the [ID] is a number datatype.

If [ID] is a Text datatype, then use:
"[ID] = '" & Me![ID] & "'"

Change [ID] to whatever the actual name of that unique field is.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #2
Glenn Zamora wrote:
I am new to MS Access. I have created a simple entry form to track
patient information. I have also created a Patient Report that prints
Patient Information with a standard disclaimer statement. I added a
print button to my entry form hoping that the patient information
that I enter will merge with the Patient Report however I must be
missing a step because when I click on the print button it prints all
patients in the database. Is there a way to filter the report so that
it will only print the current patient?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Your print button is using the DoCmd.OpenRepor t method and that method has an
optional WHERE argument where you can apply a filter to the report as it is
opened. You just need to pass in the Primary Key value on your form to that
argument.

DoCmd.OpenRepor t "ReportName",,, "PatientNum ber = " & Me.PatientNumbe r
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #3
In the query on which your report is based, you need to set in the criteria
column for PatientID

[forms]![Patients]![PatientID]

This will restrict the query to showing only records of the patient
displayed on your form. You may also, depending on the information on your
report have to put in a further criteria to restrict the report even more
such as a date.

HTH

Phil
"Glenn Zamora" <gl**********@h chd.tmc.edu> wrote in message
news:41******** **@127.0.0.1...

I am new to MS Access. I have created a simple entry form to track
patient information. I have also created a Patient Report that prints
Patient Information with a standard disclaimer statement. I added a
print button to my entry form hoping that the patient information that I
enter will merge with the Patient Report however I must be missing a
step because when I click on the print button it prints all patients in
the database. Is there a way to filter the report so that it will only
print the current patient?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 13 '05 #4

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

Similar topics

0
6481
by: CSDunn | last post by:
Hello, I have a problem with field filtering between an Access 2000 Project form (the application is called CELDT), and the report that shows the results of the filter. Both the form and the report are based on the same View addressed in the Record Source of both as 'dbo.CLMain_vw'. The View resides in a SQL Server 2000 database. There are two different problems I am having with filtering: The first involves filtering in the form by date...
8
6545
by: dick | last post by:
I am just trying to print/report the results of a "filter by selection" which is done by right-clicking a form, filling in values, and "applying the filter." I have searched the newsgroups, and there are many examples. BUT, they fail sometimes. The techique is to pass the form's Me.filter as the "where condition" in a Docmd.openreport statement in code behind a "print button" on the form.
6
2255
by: John | last post by:
Hi, I have simple database based on 3 tables. Relationship is 'one to many' between table 1 and 2, also between 2 and 3 table'one to many'. I have made form where I enter data in all 3 tables. Form has 2 subform based on relationships. I want to make report to print data which is shown on form. I want to print only data from form, not whole records from tables. Does anyone knows how to do this? I have tried with report based on query,...
1
17702
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to Create a Dynamic Crosstab Report PRODUCT :Microsoft Access PROD/VER:1.00 1.10 OPER/SYS:WINDOWS
4
4748
by: Sami | last post by:
I hope someone will tell me how to do this without having to do any VB as I know nothing in that area. I am a rank beginner in using Access. I have created a database consisting of student athletes.  I have now learned how to join two different tables in a query so that I might generate a report. Specifically, student athletes at a community college are required to graduate with an AA or AS degree.  Consequently, various steps are in...
3
2925
by: Afton | last post by:
I would like to make a form that filters a report by Supervisor and by starting and ending date. I have the supervisors in a combo box, and that works. However, I do not know how to code to let the user enter a starting and ending date and only show the records between those dates. The code that I have so far does not work for the dates, but I'm including it anyway so you show me what to change. Thanks so much! :) Here is my code (the...
1
2488
by: bruce | last post by:
Hello, I have a small form that pops up when a user moves off the current record of a rather sizeable data entry form. The purpose of this form is to list warnings about various fields on the entry form that may be incomplete or inconsistent before the user exits the record. These warnings take the form of items in a listbox. The underlying rowsource of the listbox is a delimited string (value list). I would like to be able to let...
3
2685
by: franc sutherland | last post by:
Hello, I have a report which I filter using the me.filter command in the OnOpen event. Me.Filter = "OrderID=" & Forms!variable_form_name! Me.FilterOn = True I want to be able to open that report, filtered, from different forms. How do I carry the name of the current form into the
14
7881
ollyb303
by: ollyb303 | last post by:
Hi, I am trying to create a dynamic crosstab report which will display number of calls handled (I work for a call centre) per day grouped by supervisor. I have one crosstab query (Query1) which has the following fields: SPID (supervisor ID), total:group by, as row heading Date, total:group by, as column heading Calls handled, total:sum, as value Date, total:where, criteria between and - this is taken from a form,
0
10132
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
11516
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...
1
11284
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10653
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
9854
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...
0
6072
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6290
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4901
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
2
4444
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.