Jan 24th, 2006, 11:14 AM
#1
Thread Starter
Lively Member
Print, MSHFlexgrid.
Hi all,
I know that to print a form, we use :
But sumtimes if there are no printers connected, there will error on the program. Is that normal or there is a way to solve it? I tried printing once and the paper shows alot of empty space. Can we print the form and it fits the whole page of the paper?
Another thing is that during runtime, my mshflexgrid only hilights 2 columns instead of one row. I tried to change the properties but to no avail.
Attached Images
Jan 24th, 2006, 11:38 AM
#2
Re: Print, MSHFlexgrid.
Originally Posted by
yanty
But sumtimes if there are no printers connected, there will error on the program.
Error trap the printform routine.
Jan 24th, 2006, 11:51 AM
#3
Thread Starter
Lively Member
Jan 24th, 2006, 12:00 PM
#4
Re: Print, MSHFlexgrid.
Use an error trap like this
VB Code:
Option Explicit
Private Sub PrintForm()
On Error GoTo Print_Error
Form1.PrintForm
Exit Sub
Print_Error:
On Error GoTo 0
MsgBox "Printer not available or is Offline"
End Sub
Jan 24th, 2006, 12:55 PM
#5
Re: Print, MSHFlexgrid.
Originally Posted by
yanty
...Another thing is that during runtime, my mshflexgrid only hilights 2 columns instead of one row....
Did you mean to say "one column "?
Jan 24th, 2006, 08:11 PM
#6
Thread Starter
Lively Member
Re: Print, MSHFlexgrid.
2 columns as shown in my attached image. only after i click on the row, the whole row will be highlighted.
Jan 24th, 2006, 10:28 PM
#7
Thread Starter
Lively Member
Re: Print, MSHFlexgrid.
Originally Posted by
dglienna
Use an error trap like this
VB Code:
Option Explicit
Private Sub PrintForm()
On Error GoTo Print_Error
Form1.PrintForm
Exit Sub
Print_Error:
On Error GoTo 0
MsgBox "Printer not available or is Offline"
End Sub
Isit we put this code under the command button we click for printing or do we put a call function PrintForm under the the command button?
Jan 24th, 2006, 10:44 PM
#8
Re: Print, MSHFlexgrid.
Call the function from the print button, but put the error trap in the function itself, where you open the file.
Jan 24th, 2006, 10:56 PM
#9
Thread Starter
Lively Member
Re: Print, MSHFlexgrid.
VB Code:
Private Sub cmdPrint_Click()
Call PrintForm
End Sub
Private Sub PrintForm()
On Error GoTo Print_Error
Form1.PrintForm
Exit Sub
Print_Error:
On Error GoTo 0
MsgBox "Printer not available or is Offline"
End Sub
I tried this but it states member already exist in object module.
Jan 24th, 2006, 11:10 PM
#10
Re: Print, MSHFlexgrid.
Which line generates the error?
Jan 24th, 2006, 11:15 PM
#11
Thread Starter
Lively Member
Jan 24th, 2006, 11:27 PM
#12
Re: Print, MSHFlexgrid.
PrintForm is a reserved word in VB, so you can't call your sub that.
If you have this code in the form itself, you can just call
like this:
Call your sub SendToPrinter or something like that, and change the call statement.
Jan 25th, 2006, 01:44 AM
#13
Frenzied Member
Re: Print, MSHFlexgrid.
i know its kinda out of topic but how about using a data report to print your data rather than directly printing the form. it would be a lot more easier than printing a form
this is only a suggestion okay
Jan 25th, 2006, 02:32 AM
#14
Thread Starter
Lively Member
Re: Print, MSHFlexgrid.
data report? how is that like?
Jan 25th, 2006, 02:39 AM
#15
Frenzied Member
Re: Print, MSHFlexgrid.
when in preview mode, it looks like a piece of bond paper with the data that you place on it or on your database table.
Jan 25th, 2006, 09:35 AM
#16
Re: Print, MSHFlexgrid.
Originally Posted by
yanty
data report? how is that like?
If you are interested in the Data Report, take a look at these.
Create Reports Using The Data Report
Data Report Tutorial
Data Report Demo
Dec 4th, 2006, 07:10 PM
#17
Re: Print, MSHFlexgrid.
FYI sgrya1, the last post before yours was in January.
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width