Filter out records for printing

L

Logi Bakels

G'day everyone

This is undoubtedly a simple question but I can't find a solution and would
appreciate everyone's help.

Data used in this question;-
Fields -> Company Name Date Started
Record-> Coy 1 1/1/4
Record-> Coy 2 1/1/5

I currently have a form that has a tab control on it.
On the form is the field for "company name" and on one of the tabs is the
field "Date Started".

My problem is that I want a "print" button on the tab that will only print
out what information you currently see.

I can create a report based on a query but I don't know how to filter(?) out
all records so only the record you are currently viewing, is shown in the
report.

I don't want the user to select anything as I want the computer to select
(based on Company Name) the current record that you have focus.

Thanks
Logi
 
A

Allen Browne

See:
Print the record in the form
at:
http://members.iinet.net.au/~allenbrowne/casu-15.html

The article explains how to use the WhereCondition of OpenReport to open
just the record you have in the form. It assumes you have an AutoNumber
primary key. If Company Name is a Text field (not a Number field), you will
need extra quotes, i.e.:
strWhere = "[Company Name] = """ & Me.[Company Name] & """"
 
L

Logi Bakels

Thankyou for your help. It works brilliantly and is exactly what I'm after.

Allen Browne said:
See:
Print the record in the form
at:
http://members.iinet.net.au/~allenbrowne/casu-15.html

The article explains how to use the WhereCondition of OpenReport to open
just the record you have in the form. It assumes you have an AutoNumber
primary key. If Company Name is a Text field (not a Number field), you will
need extra quotes, i.e.:
strWhere = "[Company Name] = """ & Me.[Company Name] & """"

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Logi Bakels said:
G'day everyone

This is undoubtedly a simple question but I can't find a solution and
would
appreciate everyone's help.

Data used in this question;-
Fields -> Company Name Date Started
Record-> Coy 1 1/1/4
Record-> Coy 2 1/1/5

I currently have a form that has a tab control on it.
On the form is the field for "company name" and on one of the tabs is the
field "Date Started".

My problem is that I want a "print" button on the tab that will only print
out what information you currently see.

I can create a report based on a query but I don't know how to filter(?)
out
all records so only the record you are currently viewing, is shown in the
report.

I don't want the user to select anything as I want the computer to select
(based on Company Name) the current record that you have focus.

Thanks
Logi
 
Top