Printing part of current

S

Stan

Although a newbie to Access 2000/2 this has got to be a basic question - but
nowhere (Google or here) can I find the answer so cud some kind soul pleas
put me out of my misery as how I can:-
In page 2 of my Call_Log Form I have a Name and Address of the caller. This
information I wish to print on an envelope in the printer. How can I get an
"Address_Label" report to only print out about the current record on
screen???
So far I have tried just printcommand button the report but that nicely
printed every address in the database!!
Then tried filtering the command using Where clause that I found on Google
"DoCmd.OpenReport reportname [, view] [,filtername] [,wherecondition].
However my page only has Title, Full Name, Address_1 City, Postcode as
fields so could not get my head round how I could find a unique fieldname to
filter on.

As a supplementary, if I may, how do I get the Call-Log form to open showing
the latest record and not the first?? Have tried sorting the underlying
table but to no avail??

Many thanks

Stan
 
K

Kevin Sprinkel

How can I get an "Address_Label" report to only print out
about the current record on screen???
"DoCmd.OpenReport reportname [, view] [,filtername] [,wherecondition].
However my page only has Title, Full Name, Address_1
City, Postcode as fields so could not get my head round
how I could find a unique fieldname to
filter on.

This is one reason why having a primary key is
recommended. Simply add a new AutoNumber field, say
CustomerID, to your table and make it the primary key.
As a supplementary, if I may, how do I get the Call-Log form to open showing
the latest record and not the first?? Have tried sorting the underlying
table but to no avail??
Many thanks

Stan

The database can sort by any table field. One way to do
this is to add a CallDate date field, and set its default
value to =Now(), and sort the form's underlying query in
Descending order by CallDate.

HTH
Kevin Sprinkel
 
S

Stan

Thanks Kevin,
I have a autonumbered Primary Key in the underlying table (CallID)
but how does this help giving a unique fieldname to allow only the current
record parts to be printed, as I would not necessarily know the CallID of
the current record when hitting the print button.
Bear with me ---still in kindergarden as far as Access is concerned.......
Stan

Kevin Sprinkel said:
How can I get an "Address_Label" report to only print out
about the current record on screen???
"DoCmd.OpenReport reportname [, view] [,filtername] [,wherecondition].
However my page only has Title, Full Name, Address_1
City, Postcode as fields so could not get my head round
how I could find a unique fieldname to
filter on.

This is one reason why having a primary key is
recommended. Simply add a new AutoNumber field, say
CustomerID, to your table and make it the primary key.
As a supplementary, if I may, how do I get the Call-Log form to open showing
the latest record and not the first?? Have tried sorting the underlying
table but to no avail??
Many thanks

Stan

The database can sort by any table field. One way to do
this is to add a CallDate date field, and set its default
value to =Now(), and sort the form's underlying query in
Descending order by CallDate.

HTH
Kevin Sprinkel
 
J

John Vinson

I have a autonumbered Primary Key in the underlying table (CallID)
but how does this help giving a unique fieldname to allow only the current
record parts to be printed, as I would not necessarily know the CallID of
the current record when hitting the print button.

YOu wouldn't - and you wouldn't need to; just include a textbox for
the CallID on the form which has the button, and reference that
textbox in your Filter:

strFilter = "[CallID] = " & Me!txtCallID
DoCmd.OpenReport "your-report-name", Filter := strFilter
 
K

Kevin Sprinkel

No problem, Stan; we're all learning.

The feature that a unique key field is that it
unambigously identifies THAT record and that record only.
So, even if you don't know the value, Access does, if you
put its value in a control. So in the code you were
provided, you can simply *refer* to the form control in
your Where condition, and Access will grab the value.

You needn't even show this control to your users, simply
add a text box bound to the primary key field, and set its
Visible and Enabled properties to No.

Syntax to refer to a control is:

Forms![yourformname]![yourcontrolname] for a main form.

For a subform control, understand that a subform is itself
a control on the main form, and may or may not have the
same name as the subform itself. In the reference below,
the 2nd set of brackets refer to the name of the subform
control in the main form. The last is the name of the
control in the subform that has the value of interest.

Forms![mainformname]![MFSBFctlname].Form![sbfcontrolname]

By providing a custom criteria form which allows your
users to select records by different fields, this means of
reference is also very useful for queries and reports.

HTH
Kevin Sprinkel

-----Original Message-----
Thanks Kevin,
I have a autonumbered Primary Key in the underlying table (CallID)
but how does this help giving a unique fieldname to allow only the current
record parts to be printed, as I would not necessarily know the CallID of
the current record when hitting the print button.
Bear with me ---still in kindergarden as far as Access is concerned.......
Stan

How can I get an "Address_Label" report to only print
out
about the current record on screen???
"DoCmd.OpenReport reportname [, view] [,filtername] [,wherecondition].
However my page only has Title, Full Name, Address_1
City, Postcode as fields so could not get my head round
how I could find a unique fieldname to
filter on.

This is one reason why having a primary key is
recommended. Simply add a new AutoNumber field, say
CustomerID, to your table and make it the primary key.
As a supplementary, if I may, how do I get the Call-Log form to open showing
the latest record and not the first?? Have tried
sorting
the underlying
table but to no avail??
Many thanks

Stan

The database can sort by any table field. One way to do
this is to add a CallDate date field, and set its default
value to =Now(), and sort the form's underlying query in
Descending order by CallDate.

HTH
Kevin Sprinkel


.
 
S

Stan Smith

Kevin & John,
The current record print is now working perfectly.......
Thanks - hope you're around when I get to the next head banging problem

All the best
Stan


Kevin Sprinkel said:
How can I get an "Address_Label" report to only print out
about the current record on screen???
"DoCmd.OpenReport reportname [, view] [,filtername] [,wherecondition].
However my page only has Title, Full Name, Address_1
City, Postcode as fields so could not get my head round
how I could find a unique fieldname to
filter on.

This is one reason why having a primary key is
recommended. Simply add a new AutoNumber field, say
CustomerID, to your table and make it the primary key.
As a supplementary, if I may, how do I get the Call-Log form to open showing
the latest record and not the first?? Have tried sorting the underlying
table but to no avail??
Many thanks

Stan

The database can sort by any table field. One way to do
this is to add a CallDate date field, and set its default
value to =Now(), and sort the form's underlying query in
Descending order by CallDate.

HTH
Kevin Sprinkel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top