Simple Question - Printing Flexgrid?

VBKid04
04-14-2004, 10:33 AM
If I print a flexgrid, will it look similar to what a basic report would in Access?

If not, what should I use to create a report?

I dont have the Crytal Reporting tool. Is there anything else I could use?

CrystalWizard
04-14-2004, 10:42 AM
Here is an example of creating a datareport.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconcreatingsimpledatareport.asp

MKoslof
04-14-2004, 03:24 PM
If you decide to print the flexGrid, go to the knowledge base. FlyGuy has a code sample for this..and it works quite well.

VBKid04
04-14-2004, 06:32 PM
Due to a printing problem, Ive had to change my control to an MSHFlexgrid (rather than the MSFlexgrid).

This is fine, except for one little niggle...

When I press print, the MSHFlexgrid disappears. No matter how many refreshes I do it will not reappear on the form.

Only if I close the form and open it again can I see the grid again.

My code for Print is simple, but I dont want any more hassle with it:


cmdPrint_Click()

Dim old_width as Integer
MSFlexGrid_Name.width=printer.width 'makes it full length of page

Printer.PaintPicture MSFlexGrid_Name.Picture, 0, 0
Printer.EndDoc

MSFlexGrid_Name.width=old_width ' this makes it full width of the page

End Sub




If someone could just guide me in the right direction as to why the grid is disappearing or what I have to do to make it reappear.

I have even created a form refresh function, and tried to call it after the print command, but that has not worked either.


Please can someone help?

MKoslof
04-15-2004, 06:16 AM
I told you about FlyGuy's tutorial regarding printing the FlexGrid control. Did you look at it :). This method is not going to work, you can't simply send the grid to the printer object like this.

You are going to have to create a class or print routine...one or two lines of code won't output the grid correctly. FlyGuy's example will get you started.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum