Printing fields from table

  • Thread starter Thread starter Doug
  • Start date Start date
D

Doug

I would like to fill in a 10 point, double spaced paper
form with my printer using fields from an Access table.
Aligning all of the fields with the report generator would
take days! Is there a way to loop through a table,
printing some or all of the fields in each record?
Something like:

While not end of table
loop
 
-----Original Message-----
I would like to fill in a 10 point, double spaced paper
form with my printer using fields from an Access table.
Aligning all of the fields with the report generator would
take days! Is there a way to loop through a table,
printing some or all of the fields in each record?
Something like:

While not end of table
loop
Print [field1]; spaces(5); [field2]; CrLf
[field4] FormFeed
next record
etc.
 
Doug

It'll be a little tough giving you some specific advise when there's no
specific information about your underlying fields.

Are you saying that you have a table with multiple fields, each containing
text which, when all concatenated together, makes a sentence? Or a
paragraph? Or a page?

What kind of info do you have, in what kind of fields? Have you looked into
concatenating the information together in a query, before basing a report on
that query?

More info, please!

Jeff Boyce
<Access MVP>
 
I am filling out a double spaced pica (from typewriter
days) insurance form from a multitable query. For
example, first line has LastName, Firstname| DOB| M F
(checkboxes, plan to use immediate if)| Ins#| etc. If I
hand code the form, I can trim the data to fit and
essentially concatinate fields with one space between,
with carriage returns and 2 line feeds as appropriate. By
the time I line up all of the fields with the report
generator . . . Another problem is that this form is a
statement with 6 possible line items. The total must be
on the 7th line no matter how many items are present. I
plan to use a loop with line counter and feed 6-#lines, or
a formfeed if #lines>6. If there is an easier way, I'm
open, but still curious about an answer to the original
question. Thanks again.
 
Still not quite enough information. I assume your 6 possible line items are
in a related table. If so, I recommend you use a subreport that can be sized
exactly to match the size you need printed on your main report. Bind your
main report to the table/query without the line items.

If you provide a little more information about your tables, we could be of
more assistance.
 
You are makeing this into a much more complicated question
than it is. I just want to loop through a query or table
and print each field of each record on a piece of paper,
then do a formfeed, using VBA and NOT the report
generator. I want to know if I can do that directly from
a query or table.

In other words a simplified verison of what I need is:

open table 1

do until end of table
print [field1]; space(); [field2]; CrLf;
space(10); [field3]; etc.
formfeed
next record

close table 1

I know how to create the query I need, cancatenate an
expression and do all of the loops I need. I just need
the syntax for "print [field]" and the conditions under
which it will work. For instance, maybe it can only be
done from a form rather than a table? Thanks again.
 
Doug

Queries retrieve data, apply functions, modify formats, and display the
results. Tables store data. Neither prints, nor has VBA "behind" it.

If you need to create a procedure, do it in "code behind form" (or report),
or in a code module.

If you are using DOS, and a StarWriter printer, I believe the <Esc> codes
are ... (sorry, it's been too long since I used those). Both Duane and I
asked for more information because we weren't sure we could give you
anything meaningful to go on without a better idea of where you're starting
from.

For instance, are you using Windows? Which version? Does you printer
have/recognize <Esc> codes? Which version of Access are you using?

More info, still, please...

Jeff Boyce
<Access MVP>
 
Doug said:
You are makeing this into a much more complicated question
than it is. I just want to loop through a query or table
and print each field of each record on a piece of paper,
then do a formfeed, using VBA and NOT the report
generator. I want to know if I can do that directly from
a query or table.

In other words a simplified verison of what I need is:

open table 1

do until end of table
print [field1]; space(); [field2]; CrLf;
space(10); [field3]; etc.
formfeed
next record

close table 1

I know how to create the query I need, cancatenate an
expression and do all of the loops I need. I just need
the syntax for "print [field]" and the conditions under
which it will work. For instance, maybe it can only be
done from a form rather than a table?


Not sure about what the heck you need to do, but to print
directly to the printer you should be able to use the old
direct File I/O statements. Check Help on:

Open "LPT1:" For Output As #n
Write #n list
Print #n list
Close #n
 
Back
Top