Home All Groups Group Topic Archive Search About

Database and report question

Author
20 Sep 2005 5:13 PM
Robertico
I'am not sure this is the best place for my qeustion, but maybe someone can
help me or point me in the right direction.

I develop an application that can create a database on request. (the user
can create several databases with different names)
I create these databases using DAO without datacontrols. (mdb files).
Now i'd like to create a report.
There are three text fields. One of them contains a link to an image.

[imagefile][date][description]

So i need a report with two textfields and one image(field) per page !

I was thinking of the "Data Report" but don't know how to use it.
So i have to "link" the report to the current database (name).

Please some advice or example(s) if possible.

Thanks in advance,

Robertico

Author
20 Sep 2005 9:22 PM
Veign
Some report examples:
http://www.veign.com/vrc_app_cat.asp?catid=24

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
Veign's Blog
http://www.veign.com/blog
--


Show quoteHide quote
"Robertico" <Robertico@nomail.notvalid> wrote in message
news:dgpm0i$4k4$1@localhost.localdomain...
> I'am not sure this is the best place for my qeustion, but maybe someone
can
> help me or point me in the right direction.
>
> I develop an application that can create a database on request. (the user
> can create several databases with different names)
> I create these databases using DAO without datacontrols. (mdb files).
> Now i'd like to create a report.
> There are three text fields. One of them contains a link to an image.
>
> [imagefile][date][description]
>
> So i need a report with two textfields and one image(field) per page !
>
> I was thinking of the "Data Report" but don't know how to use it.
> So i have to "link" the report to the current database (name).
>
> Please some advice or example(s) if possible.
>
> Thanks in advance,
>
> Robertico
>
>
Author
21 Sep 2005 4:47 AM
Robertico
Thanks for the examples.
Is there a way to insert an image to my report.
One of my fields contains the filname (path) of an image.

Regards,

Robertico
Author
21 Sep 2005 5:20 AM
Veign
Not something you going to get from the DataReport that comes with VB.  You
will need to use something like Crystal Reports or ActiveReports.

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
Veign's Blog
http://www.veign.com/blog
--


Show quoteHide quote
"Robertico" <Robertico@nomail.notvalid> wrote in message
news:dgqukv$hk3$1@localhost.localdomain...
> Thanks for the examples.
> Is there a way to insert an image to my report.
> One of my fields contains the filname (path) of an image.
>
> Regards,
>
> Robertico
>
>
Author
21 Sep 2005 6:02 AM
Robertico
> Not something you going to get from the DataReport that comes with VB.
> You
> will need to use something like Crystal Reports or ActiveReports.

Thanks.
I now do some research with Ms Word templates and bookmarks.

Robertico
Author
21 Sep 2005 6:01 AM
Mike Williams
"Robertico" <Robertico@nomail.notvalid> wrote in message
news:dgqukv$hk3$1@localhost.localdomain...
..
> Is there a way to insert an image to my report.

Why not just use the VB printer object. You can do whatever you want then.

Mike
Author
21 Sep 2005 6:16 AM
Robertico
> Why not just use the VB printer object. You can do whatever you want then.

I'am not familiar with that. Can you explain a little more ?

Regards,

Robertico
Author
21 Sep 2005 7:20 AM
Mike Williams
"Robertico" <Robertico@nomail.notvalid> wrote in message
news:dgr3t4$i36$1@localhost.localdomain...

> I'am not familiar with that [VB printer object].
> Can you explain a little more ?

Yep, but first I need to ccheck what version of VB you are using. If it is
VBA (instead of a standard full version such as VB5 or VB6) then you won't
have a printer object. What version of VB are you using?

Mike
Author
21 Sep 2005 7:29 AM
Robertico
I'am using VB6 (SP6).

Robertico
Author
21 Sep 2005 8:32 AM
Mike Williams
"Robertico" <Robertico@nomail.notvalid> wrote in message
news:dgr84c$j32$1@localhost.localdomain...

> I'am using VB6 (SP6).

Right. You'll be okay then. By the way, I'm assuming this is for a report
that is to be printed (to a printer), although you can of course also print
it to a Picture Box for display purposes. As long as you can get the data
from the database, and as long as you know where you want to place the
individual data items on the printed page, you can do more or less whatever
you want. What sort of report is it? What does the printed output need to
have (text, pictures, lines, boxes, etc)? How many pages?

For starters, try printing simple text and lines or boxes (although you can
also print anything else you want). Paste the following into a VB Form
containing a Command Button:

Mike

Option Explicit
Private Declare Function GetDeviceCaps Lib "gdi32" _
  (ByVal hdc As Long, ByVal nindex As Long) As Long
Private Const PHYSICALOFFSETX As Long = 112
Private Const PHYSICALOFFSETY As Long = 113

Private Sub SetPrinterOrigin(x As Single, y As Single)
With Printer
  .ScaleLeft = .ScaleX(GetDeviceCaps(.hdc, PHYSICALOFFSETX), _
    vbPixels, .ScaleMode) - x
  .ScaleTop = .ScaleY(GetDeviceCaps(.hdc, PHYSICALOFFSETY), _
    vbPixels, .ScaleMode) - y
  .CurrentX = 0
  .CurrentY = 0
End With
End Sub

Private Sub SetupPrinter()
  Printer.Print ' open the printer object
  Printer.ScaleMode = vbInches
  ' set origin to top left corner of physical page
  SetPrinterOrigin 0, 0
  Printer.Font.Name = "Times New Roman"
  Printer.Font.Size = 12
End Sub

Private Sub PrintAt(x1 As Single, y1 As Single, s1 As String)
  Printer.CurrentX = x1
  Printer.CurrentY = y1
  Printer.Print s1;
End Sub

Private Sub Command1_Click()
  SetupPrinter ' initialise printer object
  Printer.Line (1, 1)-(2, 2), vbBlack, B ' a one inch box
  PrintAt 2, 2, "Some Text Here"
  PrintAt 3, 3, "Some More Text Here"
  Printer.EndDoc
End Sub
Author
21 Sep 2005 9:05 AM
Robertico
> .......By the way, I'm assuming this is for a report that is to be printed
> (to a printer), ....

Yes, it has to be printed

> What sort of report is it? What does the printed output need to have
> (text, pictures, lines, boxes, etc)? How many pages?

My database contains five fields
[Filename][Author][Date][Description][Report]
The filename field contains the complete path to an image (photo) and the
Report field, Yes/No (add to report ?)
So i need a report with my image in the middle and the Author, Date and
Description below the image.
So i need one or more (depends on the Report field) pages.

I give your code a try. Thanks a lot !!


Regards,

Robertico
Author
21 Sep 2005 10:20 AM
Mike Williams
"Robertico" <Robertico@nomail.notvalid> wrote in message
news:dgrdp5$kt1$1@localhost.localdomain...

> My database contains five fields
> [Filename][Author][Date][Description][Report] The
> filename field contains the complete path to an image
> (photo) and the Report field, Yes/No (add to report ?)
> So i need a report with my image in the middle and the
> Author, Date and Description below the image.

That should be fairly straightforward. What size paper are you using, and
how many individual "reports" do you want per page (or, alternatively, how
large do you want the printed picture to be?). By the way, what is the
format of the image (bmp, jpg or whatever)?

Mike
Author
21 Sep 2005 10:45 AM
Robertico
> That should be fairly straightforward. What size paper are you using, and
> how many individual "reports" do you want per page (or, alternatively, how
> large do you want the printed picture to be?). By the way, what is the
> format of the image (bmp, jpg or whatever)?

Paper size A4 (210 x 297 cm)
One report per page (one photo with text) with Left margin 2,5 cm and Right
margin 1,5 cm.
Original Images are jpg files with various resolutions. (There are photos in
portrait and landscape format. )

I don't know if it's possible to print the portrait photos as portrait in
the report without changing the original image ?
But I'am very happy IF i can print my reports. It's the most difficult part
of the whole application for me :-((

BTW i'am very happy that you take so much time to help me.

Robertico
Author
21 Sep 2005 1:58 PM
lucas.hardbarger
You might look into using a 3rd party control to do your printing.
ActiveReports has a good price on it and makes reporting very easy to
do for any and all projects. There are others out there too with visual
designers. The best thing to tell you is to evaluate the various
controls to see which one will meet your needs. Of course you can use
the Printer object directly, but it lacks flexibility and could take a
lot of time if you are not familiar with printing. Hope this helps.
Author
21 Sep 2005 2:52 PM
Robertico
> You might look into using a 3rd party control to do your printing.
> ActiveReports has a good price on it and makes reporting very easy to
> do for any and all projects. There are others out there too with visual
> designers. The best thing to tell you is to evaluate the various
> controls to see which one will meet your needs. Of course you can use
> the Printer object directly, but it lacks flexibility and could take a
> lot of time if you are not familiar with printing. Hope this helps.
>

Is ActiveReports from datadynamics ?

Robertico
Author
21 Sep 2005 3:02 PM
Veign
Yes.

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
Veign's Blog
http://www.veign.com/blog
--


Show quoteHide quote
"Robertico" <Robertico@nomail.notvalid> wrote in message
news:dgs22v$rd8$1@localhost.localdomain...
> > You might look into using a 3rd party control to do your printing.
> > ActiveReports has a good price on it and makes reporting very easy to
> > do for any and all projects. There are others out there too with visual
> > designers. The best thing to tell you is to evaluate the various
> > controls to see which one will meet your needs. Of course you can use
> > the Printer object directly, but it lacks flexibility and could take a
> > lot of time if you are not familiar with printing. Hope this helps.
> >
>
> Is ActiveReports from datadynamics ?
>
> Robertico
>
>
Author
21 Sep 2005 3:45 PM
Mike Williams
"Robertico" <Robertico@nomail.notvalid> wrote in message
news:dgrjl7$ms5$1@localhost.localdomain...

> Paper size A4 (210 x 297 cm) One report per page (one photo with text)
> with Left margin 2,5 cm and Right margin 1,5 cm. Original Images are jpg
> files with various resolutions. (There are photos in portrait and
> landscape
> format. ) I don't know if it's possible to print the portrait photos as
> portrait
> in the report without changing the original image ?

Yes. You can print the photos in any orientation you want. You have to be
quite clear about what you want, though. For example, let's take the case of
a photo that is in portrait mode. You have said that you want a left margin
of 2.5 cm and a right margin of 1.5 cm. Presumably you want the width of the
photo to fill the remaining space (which is 17 cm on an A4 page). In that
case, if the photo has a height to width ratio of about 1.33 (typical of
many photos) then the printed height of the photo will need to be 17 * 1.33
= 22.61 cm in order to maintain the correct aspect ratio. Such a photo would
therefore fill about three quarters of the page, with the remaining one
quarter (less desired top and bottom margins) being left available for
printing your text. If instead the height to width ratio was 1.4 (another
typical aspect ratio) then the printed height (if you want the width to
remain constant) would be 17 * 1.4 =  23.8 cm, which would leave just 5.9 cm
(less the desired top and bottom margins) for the text. It would therefore
be best to set the top margin to 1.5 cm in all cases, in order to leave
sufficient room for the text for any photo with a height to width ratio of
1.4 or less (not many photos would have an aspect ratio greater than 1.4 so
I think you can ignore such a possibility). So is that what you want in the
case of a portrait photo? Try it out and see. By the way, in order to get
decent quality prints any photo should ideally have a minimum pixel
resolution of 150 pixels per printed inch, so that to print with good
quality at the size you desire the original jpg image should ideally have a
pixel size of about 1000 x 1300 or greater. Is that the case?

Anyway, try out the following code. It's just the "bare bones" of it at the
moment, and needs a lot more work, but it should do what you want (if you
provide it with a portrait mode photo). Just paste the code into a VB Form
containing a Command Button and change the hard coded "c:\myphoto.jpg" to
point to a valid portrait mode photo on your own system. You should end up
with a printed photo with a left page border of exactly 2.5 cm and top and
right page borders of exactly 1.5 cm and the photo should be printed at its
exact original aspect ratio, with a bit of text printed 1 cm below it. Is
that the sort of thing you want? Don't worry about telling me if it is not
what you want, and if you agree with Vein about it being too much work.
Anyway, here's the code as it stands so far (just a bit of test bed code
really at this stage):

Mike

Option Explicit
Private Declare Function GetDeviceCaps Lib "gdi32" _
  (ByVal hdc As Long, ByVal nindex As Long) As Long
Private Const PHYSICALOFFSETX As Long = 112
Private Const PHYSICALOFFSETY As Long = 113

Private Sub SetPrinterOrigin(x As Single, y As Single)
With Printer
  .ScaleLeft = .ScaleX(GetDeviceCaps(.hdc, PHYSICALOFFSETX), _
    vbPixels, .ScaleMode) - x
  .ScaleTop = .ScaleY(GetDeviceCaps(.hdc, PHYSICALOFFSETY), _
    vbPixels, .ScaleMode) - y
  .CurrentX = 0
  .CurrentY = 0
End With
End Sub

Private Sub SetupPrinter()
  Printer.Print ' open the printer object
  Printer.ScaleMode = vbCentimeters
  ' set origin to top left corner of physical page
  SetPrinterOrigin 0, 0
  Printer.Font.Name = "Times New Roman"
  Printer.Font.Size = 12
End Sub

Private Sub PrintAt(x1 As Single, y1 As Single, s1 As String)
  Printer.CurrentX = x1
  Printer.CurrentY = y1
  Printer.Print s1;
End Sub

Private Sub Command1_Click()
Dim fname As String, ratio As Single, p1 As StdPicture
Dim Lmargin As Single, Rmargin As Single, Tmargin As Single
Dim pageWide As Single, picWide As Single, picHigh As Single
Lmargin = 2.5: Rmargin = 1.5: Tmargin = 1.5
pageWide = Printer.ScaleX(Printer.Width, vbTwips, Printer.ScaleMode)
fname = "c:\myphoto.jpg"
Set p1 = LoadPicture(fname)
ratio = p1.Height / p1.Width
If ratio > 1 Then ' portrait
SetupPrinter ' initialise printer object
picWide = pageWide - (Lmargin + Rmargin)
picHigh = picWide * ratio
Printer.PaintPicture p1, Lmargin, Tmargin, picWide, picWide * ratio
PrintAt Lmargin, Tmargin + picHigh + 1, "Any text you want here."
Printer.EndDoc
Else
'
End If
End Sub
Author
21 Sep 2005 5:04 PM
Robertico
Show quote Hide quote
> Yes. You can print the photos in any orientation you want. You have to be
> quite clear about what you want, though. For example, let's take the case
> of a photo that is in portrait mode. You have said that you want a left
> margin of 2.5 cm and a right margin of 1.5 cm. Presumably you want the
> width of the photo to fill the remaining space (which is 17 cm on an A4
> page). In that case, if the photo has a height to width ratio of about
> 1.33 (typical of many photos) then the printed height of the photo will
> need to be 17 * 1.33 = 22.61 cm in order to maintain the correct aspect
> ratio. Such a photo would therefore fill about three quarters of the page,
> with the remaining one quarter (less desired top and bottom margins) being
> left available for printing your text. If instead the height to width
> ratio was 1.4 (another typical aspect ratio) then the printed height (if
> you want the width to remain constant) would be 17 * 1.4 =  23.8 cm, which
> would leave just 5.9 cm (less the desired top and bottom margins) for the
> text. It would therefore be best to set the top margin to 1.5 cm in all
> cases, in order to leave sufficient room for the text for any photo with a
> height to width ratio of 1.4 or less (not many photos would have an aspect
> ratio greater than 1.4 so I think you can ignore such a possibility). So
> is that what you want in the case of a portrait photo? Try it out and see.
> By the way, in order to get decent quality prints any photo should ideally
> have a minimum pixel resolution of 150 pixels per printed inch, so that to
> print with good quality at the size you desire the original jpg image
> should ideally have a pixel size of about 1000 x 1300 or greater. Is that
> the case?
>
> Anyway, try out the following code. It's just the "bare bones" of it at
> the moment, and needs a lot more work, but it should do what you want (if
> you provide it with a portrait mode photo). Just paste the code into a VB
> Form containing a Command Button and change the hard coded
> "c:\myphoto.jpg" to point to a valid portrait mode photo on your own
> system. You should end up with a printed photo with a left page border of
> exactly 2.5 cm and top and right page borders of exactly 1.5 cm and the
> photo should be printed at its exact original aspect ratio, with a bit of
> text printed 1 cm below it. Is that the sort of thing you want? Don't
> worry about telling me if it is not what you want, and if you agree with
> Vein about it being too much work. Anyway, here's the code as it stands so
> far (just a bit of test bed code really at this stage):

Mike,

I tried your code and printed it using a PDF printer. (PDF-file) Works
great.
Let me more specific about portrait mode. (sorry English is not my native
language)
All photos has the same height to width ratio. But when the photo was taken,
the camera was rotated 90 degrees.
So the subject is in "portrait" mode and not the photo.
When i look at the Exif infomation
Rotated 90 degree: Orientation - Right Upper
Normal: Orientation - Upper left
So if a want to rotate the image correct i need some Exif info. (rotate to
left or right) Correct ?
But rotation isn't so important for me. (though, it makes the report more
complete :-) )
I 'll be very happy when i can print my records to a pdf-file.

With reference to the pixel size. My photos have a pixel size of 2272 x
1704.
But i'am not sure others have. (maybe 800x600, depends on available memory)
It's not necessary to use al space between left and right margin.
Approximately 13 cm x 17 cm per photo is enough.

Tomorrow i'll i take some time for your code.
If i can get this working for my application and print all selected records,
it's great and it's just what i want.
My challenge is to print every photo (incl. some text) to a new page in one
PDF-file.
(I have the same challenge using Ms Word as report tool)

Regards,

Robertico
Author
21 Sep 2005 7:25 PM
Mike Williams
"Robertico" <Robertico@nomail.notvalid> wrote in message
news:dgs9qv$tth$1@localhost.localdomain...

> All photos has the same height to width ratio. But when the
> photo was taken, the camera was rotated 90 degrees.
> So the subject is in "portrait" mode and not the photo.
> When i look at the Exif infomation. Rotated 90 degree:
> Orientation - Right Upper Normal: Orientation - Upper left
> So if a want to rotate the image correct i need some Exif info
> (rotate to left or right) Correct ?

Yep. You'll need to get that data from the jpg in order to find out whether
to rotate 90 degree left or right. Actually rotating the picture is quite
easy, and can be done very quickly in VB, but I'm afraid I don't know how to
get at that Exif data from the jpg file. It's a bit pointless giving you
some rotation code until the Exif data is sorted out. I'll have a dig around
later if I get time, but in the meantime maybe someone here already knows
how to get that data and can post an example?

> With reference to the pixel size. My photos have a pixel size of
> 2272 x 1704. But i'am not sure others have. (maybe 800x600,
> depends on available memory)

That's fine, especially since you now want to print the photos at 13 x 17
cm. They are the same ratio, and even the 800 x 600 photo will print
reasonably well at 13 x 17 cm (120 pixels per inch is enough unless you want
high photo quality output).

> It's not necessary to use al space between left and right margin.
> Approximately 13 cm x 17 cm per photo is enough.

Okay. You can of course position and size the photo anywhere you want on the
page. On an A4 page I would sugest that it should be positioned centrally
(left to right) with about 2.5 cm top margin. It's up to you though. You can
put it where you want.

> Tomorrow i'll i take some time for your code. If i can get this working
> for my application and print all selected records, it's great and it's
> just
> what i want.

Good. It should be easy to amend the code to do what you want and to print
as many pages as you require. It's pointless going much further just yet
though, at least until we've found a way to get at that Exif data. In the
meantime, if you get your problem solved in another way and don't require
any further help with this code then post again and let me know.

Mike
Author
21 Sep 2005 9:14 PM
Veign
Exif Data Reader:
http://www.veign.com/vrc_codeview.asp?type=app&id=104

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
Veign's Blog
http://www.veign.com/blog
--


Show quoteHide quote
"Mike Williams" <M***@WhiskyAndCoke.com> wrote in message
news:dgsc2r$ce7$1@newsg2.svr.pol.co.uk...
> "Robertico" <Robertico@nomail.notvalid> wrote in message
> news:dgs9qv$tth$1@localhost.localdomain...
>
> > All photos has the same height to width ratio. But when the
> > photo was taken, the camera was rotated 90 degrees.
> > So the subject is in "portrait" mode and not the photo.
> > When i look at the Exif infomation. Rotated 90 degree:
> > Orientation - Right Upper Normal: Orientation - Upper left
> > So if a want to rotate the image correct i need some Exif info
> > (rotate to left or right) Correct ?
>
> Yep. You'll need to get that data from the jpg in order to find out
whether
> to rotate 90 degree left or right. Actually rotating the picture is quite
> easy, and can be done very quickly in VB, but I'm afraid I don't know how
to
> get at that Exif data from the jpg file. It's a bit pointless giving you
> some rotation code until the Exif data is sorted out. I'll have a dig
around
> later if I get time, but in the meantime maybe someone here already knows
> how to get that data and can post an example?
>
> > With reference to the pixel size. My photos have a pixel size of
> > 2272 x 1704. But i'am not sure others have. (maybe 800x600,
> > depends on available memory)
>
> That's fine, especially since you now want to print the photos at 13 x 17
> cm. They are the same ratio, and even the 800 x 600 photo will print
> reasonably well at 13 x 17 cm (120 pixels per inch is enough unless you
want
> high photo quality output).
>
> > It's not necessary to use al space between left and right margin.
> > Approximately 13 cm x 17 cm per photo is enough.
>
> Okay. You can of course position and size the photo anywhere you want on
the
> page. On an A4 page I would sugest that it should be positioned centrally
> (left to right) with about 2.5 cm top margin. It's up to you though. You
can
> put it where you want.
>
> > Tomorrow i'll i take some time for your code. If i can get this working
> > for my application and print all selected records, it's great and it's
> > just
> > what i want.
>
> Good. It should be easy to amend the code to do what you want and to print
> as many pages as you require. It's pointless going much further just yet
> though, at least until we've found a way to get at that Exif data. In the
> meantime, if you get your problem solved in another way and don't require
> any further help with this code then post again and let me know.
>
> Mike
>
>
>
Author
21 Sep 2005 9:49 PM
Mike Williams
"Veign" <NOSPAMinveign@veign.com> wrote in message
news:eZfhaIvvFHA.2072@TK2MSFTNGP14.phx.gbl...

> Exif Data Reader:
> http://www.veign.com/vrc_codeview.asp?type=app&id=104

Thanks Chris. Looks interesting. I'll check that out when this sleeping pill
wears off ;-)

Mike
Author
21 Sep 2005 9:38 PM
Mike Williams
"Mike Williams" <M***@WhiskyAndCoke.com> wrote in message
news:dgsc2r$ce7$1@newsg2.svr.pol.co.uk...

> Yep. You'll need to get that data [Exif Data] from the jpg in
> order to find out whether to rotate 90 degree left or right.

I've just had a quick look around and it seems that some cameras append the
full Exif data to the jpg file (including the way in which the orientation
has been rotated) and some don't. In addition to that, any jpg file that has
been in any way "doctored" or resaved by most typical photo editing programs
(and many jpgs that you come across will have been through such a
process)completely lose virtually all of the original Exif info, even if it
did happen to be there in the first place. So, it looks like any automatic
"rotate left or rotate right" code will be very "hit and miss", no matter
how well you program it. The alternative of attempting to "intelligently
analyze" the jpg bitmap data in an attempt to find out "what might be the
sky and what might be the ground" will also be extremely difficult to write,
and will be prone to errors. I'm afraid that this is just one of the many
"processes" that a human being can do extremely reliably in the blink of an
eye, whereas any computer program will take an age to do it (by comparison)
and will also fail to get it right on many occasions. Today's computer
hardware and  software might seem like "magic" to the uninitiated, but I'm
afraid that even the best computer system is not even nearly as clever as
the average house fly! Don't worry too much though. I imagine that even the
very best "professionally produced report generators" that you might pay a
fortune for will also fall down badly in this respect ;-)

Will this "the photo might be printed upside down" thing (if you try to
automate the rotate direction) be a problem for you?

Personally, I would just opt for a simple "rotate 90 degrees right" and have
done with it!

Mike
Author
22 Sep 2005 8:36 AM
Mike Williams
"Robertico" <Robertico@nomail.notvalid> wrote in message
news:dgs9qv$tth$1@localhost.localdomain...

.. . . just a quickie, Roberto (this thread is far too long already!) but
since you have now decided to have a picture size of 13 x 17 cm and since
you appear to want to print just a small amount of text underneath it then
you might want to consider the fact that you can get two such "reports" onto
each A4 page, or alternatively you can use A5 paper instead of A4. Just a
thought.

Mike
Author
22 Sep 2005 10:47 AM
Robertico
Mike,

I 'll focus on two things now.

- Get this code working for all records.
  (One photo with text on one page (A4) in one single document. Add some
pagebreaks somewhere i think.
   A5 paper or two photos per page isn't an option , but thanks !)

- Possibility to select a PDF-printer as the default printer for my app.
  (Presume an user has two printers installed, a 'normal' printer and a
PDF-printer.
   The 'normal' printer is the default printer. Now i need to print to the
PDF-printer without changing the users default printer.
   The report must be printed and saved (did i mentioned that before ?).
   If i can't save the report, then using the VB printer object isn't an
option)

If i get this working, i take a look at the rotation stuff.

Robertico
Author
22 Sep 2005 1:19 PM
Mike Williams
"Robertico" <Robertico@nomail.notvalid> wrote in message
news:dgu83k$fqp$1@localhost.localdomain...

> The report must be printed and saved (did i mentioned that
> before ?). If i can't save the report, then using the VB printer
> object isn't an option)

Yes of course you can save it. But if you're "rolling your own" report
printing function (using the printer object) then you'll probably want to
"roll your own" report saving function as well, which will save the report
data in your own format. If, however, you really want to save and print
these reports in a format that can be loaded into other applications as well
then maybe you would be better off with Chris Hanscom's (Veign's) suggestion
of using a third party reporting tool for the whole job. It's up to you. It
depends on how much work you are prepared to do.

Mike
Author
22 Sep 2005 1:32 PM
Robertico
Mike,

Have your code working for all selected records.
Added a loop with a Printer.NewPage after every record
I use a PDf printer driver to save and print my reports. Looks fantastic !
Also found an old VB book with some explanation about the VB printer object.
:-))

The main question is how to print to the PDF-printer instead of the default
'normal' printer.
(Without changing the dafault printer)

I use this peace of code to enum. the available printers.

    Private Sub cmdEnumPrinter_Click()
        Dim x As Printer
       For Each x In Printers
       Debug.Print x.DeviceName
       Next
    End Sub

How can i, using your code, set a reference to the desired printer.

I think i see the horizon :-))

Regards,

Robertico
Author
22 Sep 2005 5:16 PM
Mike Williams
"Robertico" <Robertico@nomail.notvalid> wrote in message
news:dguhq7$j0g$1@localhost.localdomain...

> Mike, have your code working for all selected records.
> Added a loop with a Printer.NewPage after every record
> I use a PDf printer driver to save and print my reports.
> Looks fantastic !      How can i, using your code, set a
> reference to the desired printer.

I don't know what the devicce name of your PDF printer driver is (I've never
used PDF myself) but I'm sure that you obviously know it. All you need to do
is search the available printers for one with a driver of that name and then
point the VB printer object at it. In fact it is often better to look for
just "part of the desired printer device name", just in case it is slightly
different than the exact name you specify. Try this (the example looks for
the first available printer with PDF in its name, but you can obviously
change that to suit your own purposes):

Dim pobject As Printer
For Each pobject In Printers
If InStr(1, pobject.DeviceName, "PDF", vbTextCompare) > 0 Then
  Set Printer = pobject
  Exit For
End If
Next pobject

> I think i see the horizon :-))

Hopefully, you should be able to see over the horizon now :-))

Mike
Author
22 Sep 2005 5:50 PM
Robertico
Mike,

Thank you for your patience and endurance.
I get it working now. (There's indeed PDF in the printers name and also the
manufacturers name  :-)) )
You taught me a lot of new things. Thank you very much.
Have a nice day and greetings from the Netherlands.

Robertico
Author
22 Sep 2005 6:09 PM
Mike Williams
"Robertico" <Robertico@nomail.notvalid> wrote in message
news:dgv0t9$o2j$1@localhost.localdomain...

> Mike, thank you for your patience and endurance. I get it working
> now. (There's indeed PDF in the printers name and also the manufacturers
> name  :-)) )  You taught me a lot of new things.
> Thank you very much. Have a nice day and greetings from the
> Netherlands.

Thanks Robertico. You're very welcome. By the way, don't forget to come back
here if you ever need advice on how to rotate any of your images.

Mike
Author
23 Sep 2005 7:44 AM
Robertico
> ...... By the way, don't forget to come back here if you ever need advice
> on how to rotate any of your images.

Thank you for your offer !
It's always pleasant to meet people with the same interest.
Thats what newsgroups for :-)

Regards,

Robertico
Author
21 Sep 2005 2:32 PM
Veign
That is going to be a whole lot more work then using a 3rd party reporting
tool and just may cause more grief in the end...

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
Veign's Blog
http://www.veign.com/blog
--


Show quoteHide quote
"Mike Williams" <M***@WhiskyandCoke.com> wrote in message
news:dgqsvv$fq2$1@newsg1.svr.pol.co.uk...
> "Robertico" <Robertico@nomail.notvalid> wrote in message
> news:dgqukv$hk3$1@localhost.localdomain...
> .
> > Is there a way to insert an image to my report.
>
> Why not just use the VB printer object. You can do whatever you want then.
>
> Mike
>
>
>
Author
21 Sep 2005 3:14 PM
Mike Williams
"Veign" <NOSPAMinveign@veign.com> wrote in message
news:Ox0YknrvFHA.612@TK2MSFTNGP10.phx.gbl...

> That is going to be a whole lot more work then using a 3rd
> party reporting tool and just may cause more grief in the end...

Of course it's a whole lot more work, just as writing an application to
perform a specific task (which you presumably do yourself from time to time)
is a whole lot more work than paying someone else to write it for you ;-)

But the OP appears to want to produce very simple reports, and from what he
has described so far there will be very little work to do. I imagine that
when he's looked at a few more posts he'll make up his own mind up whether
he wants to do some work or whether he would rather pay out some money. It's
up to him. Alternatively, of course, he could use a free reporting tool,
provided that he is prepared to stick with its limitations. I think for the
time being I'll continue to answer his messages, and leave him to make up
his own mind. If he decides that its going to be too much work then
presumably he'll tell us so, and I will then stop giving him any further
answers.

Sound fair enough to me.

Mike
Author
21 Sep 2005 3:45 PM
Veign
I have no problem with the advice you are giving - I have several custom
reporting classes using the Printer object that I have written.

Just mentioned it because it seems the OP is just starting out and writing a
reporting tool might be overwhelming...

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
Veign's Blog
http://www.veign.com/blog
--


Show quoteHide quote
"Mike Williams" <M***@WhiskyAndCoke.com> wrote in message
news:dgrtc8$1ft$1@newsg2.svr.pol.co.uk...
> "Veign" <NOSPAMinveign@veign.com> wrote in message
> news:Ox0YknrvFHA.612@TK2MSFTNGP10.phx.gbl...
>
> > That is going to be a whole lot more work then using a 3rd
> > party reporting tool and just may cause more grief in the end...
>
> Of course it's a whole lot more work, just as writing an application to
> perform a specific task (which you presumably do yourself from time to
time)
> is a whole lot more work than paying someone else to write it for you ;-)
>
> But the OP appears to want to produce very simple reports, and from what
he
> has described so far there will be very little work to do. I imagine that
> when he's looked at a few more posts he'll make up his own mind up whether
> he wants to do some work or whether he would rather pay out some money.
It's
> up to him. Alternatively, of course, he could use a free reporting tool,
> provided that he is prepared to stick with its limitations. I think for
the
> time being I'll continue to answer his messages, and leave him to make up
> his own mind. If he decides that its going to be too much work then
> presumably he'll tell us so, and I will then stop giving him any further
> answers.
>
> Sound fair enough to me.
>
> Mike
>
>
Author
21 Sep 2005 4:53 PM
Mike Williams
"Veign" <NOSPAMinveign@veign.com> wrote in message
news:uQJ1OQsvFHA.708@TK2MSFTNGP10.phx.gbl...

> I have no problem with the advice you are giving - I have
> several custom reporting classes using the Printer object
> that I have written. Just mentioned it because it seems the
> OP is just starting out and writing a reporting tool might be
> overwhelming...

That's okay. In fact I agree with you that writing a fully fledged general
reporting tool would probably be daunting for a beginner. It's just that he
seemed from his posts to have a very definite single requirement to produce
output that is very simple to do, so I thought I'd show him how to do that
one specific job.

Mike
Author
21 Sep 2005 3:30 PM
Robertico
ActiveReports is very expensive for programming as a hobby.

I'am still interested in the printer object.

Also doing some investigation using Ms Word (Can print and save the report).
Now i can send one record to Ms Word (Using tables and Bookmarks).
Working on it to make a new page for every record (one image per page)
Maybe someone has experience with this ?

Robertico