Results 1 to 11 of 11
  1. #1
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    DataReport without DataSource (VB6)

    Not sure if I titled this thread correctly but it will make sense in a while.

    I'm new to VB and picking things up as I go, but here's what I need to do.

    I've created a utility which will pick up PDF's and JPG's from designated folders and view them together on one screen.
    The pdf control allows printing, straight forward enough, but need to print the Images by selection and place them on a DataReport.

    I've checked out the DataReport and done several Googles for tutorials, but can't find anything to get me started.
    So the question is, how do I transfer my selected images from the list (List is already created) and have them nicely spaced on a report.
    The DataReport looks very similar to Access but haven't got a clue how to start.

    I don't need to link to a database, hence the thread title.

    Can some-one help ?

  2. #2
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DataReport without DataSource (VB6)

    I've checked again this morning and every example I can find relates to the datareport having a recordset, table or other source from databases.
    Does this have to be so and can't a report be based on a folders content or VB form list control using a path to the folder ?

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: DataReport without DataSource (VB6)

    You can create a recordset in memory using ADO, Dave. That might be your best option in this case. Build an array of the data you want to display in the report, then loop through its elements and use the .AddNew method of the ADO recordset for each record and use the Array() function to build a paramarray of the individual fields for each record. It's a little complicated to describe (and a bit to do) but it will convert an array of structured data into a recordset, which you can then use to populate a form or report.
    Charlotte

  4. #4
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DataReport without DataSource (VB6)

    Charlotte
    The form I use to show images kind of represents a thumbnail view. (Basically picture controls, "Img1 thru to Img12")

    Could I use a similar form to achieve my goal using the PrintForm method ?
    or
    Recreate the form with Pic controls on a report to do the same thing ?
    Would the code I use on the form differ for the report vastly ie using LoadPicture: Me.Controls("img" & i).Picture = LoadPicture()

    I've been reading a lot today on the PaintPicture method, maybe this is the way to go.

  5. #5
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DataReport without DataSource (VB6)

    I've had a little play around and I can reproduce a form with a white background to look like a report.

    PrintForm method will be suffice from there, thanks for the starter.

  6. #6
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DataReport without DataSource (VB6)

    Ok, I've created the form with several image controls, the command:

    frmPrint.PrintForm, seems to print the form ok, but if I change the settings in the print dialog, nothing changes.
    I tried to set the dialog to print in Landscape as below in bold, but when pressing ok, the printout is still in portrait.
    If I change the quality setting, the same, the printout prints to whatever the default setting is.

    <pre> 'CancelError is True.
    CmnDialogPrint.CancelError = True
    On Error GoTo ErrHandler

    CmnDialogPrint.ShowPrinter
    CmnDialogPrint.Orientation = cdlLandscape
    With CmnDialogPrint
    frmPrint.PrintForm
    End With

    Exit Sub
    ErrHandler:

    ' User pressed Cancel button.
    MsgBox "Print Cancelled", , "Cancel"</pre>


  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: DataReport without DataSource (VB6)

    According to help, PrintForm
    <hr>Sends a bit-by-bit image of a Form object to the printer<hr>
    That suggests to me that no matter what settings you use, the image is going to stay the same shape anyhow. Also PrintForm is a simple minded method that uses the control panel settings to pick a printer and print to it. I suspect you're going to get the default settings for that printer regardless. I've run into similar problems using the Printer object in Office XP in Access.
    Charlotte

  8. #8
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DataReport without DataSource (VB6)

    So does this mean I can't change the printer preferences at all, by code or by selection ?

  9. #9
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DataReport without DataSource (VB6)

    I've now been able to control the printer Orientation to landscape but can't find a setting for Quality.
    Does one exist or is this printer specific ?

    I can use :

    Printer.PrintQuality = vbPRPQmedium etc but still doesn't work, maybe I haven't inserted into my code correctly:

    <pre> 'CancelError is True.
    CmnDialogPrint.CancelError = True
    On Error GoTo ErrHandler

    CmnDialogPrint.ShowPrinter

    If CmnDialogPrint.Orientation = cdlLandscape Then
    Printer.Orientation = cdlLandscape
    Else
    Printer.Orientation = cdlPortrait
    End If

    With CmnDialogPrint

    Me.txtEst.Visible = False
    Me.cmdFirst.Visible = False
    Me.cmdPrev.Visible = False
    Me.cmdNext.Visible = False
    Me.cmdLast.Visible = False
    Printer.PrintQuality = -3
    frmPrint.PrintForm
    End With

    Exit Sub
    ErrHandler:

    ' User pressed Cancel button.
    MsgBox "Print Cancelled", , "Cancel"</pre>


  10. #10
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: DataReport without DataSource (VB6)

    I've only done it by retrieving the PrtDevMode properties and modifying them, so I can't say for sure. I suspect there is no "Quality" property because that would vary with the printer driver.
    Charlotte

  11. #11
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DataReport without DataSource (VB6)

    Thanks Charlotte for the help on this, you've been very helpful.

    Alas at the end of this I think I will have to source another way to accomplish this instead.
    I think I've seen some where a way to print a form without using "PrintForm" method, I think by copying to clipboard first.

    I'm off to Google, thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •