borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2008 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Next Topic (Using an old .bas module) New Topic New Poll Post Reply
AndreaVB Forum : VB General : Printer.?
Poster Message
BobBarker
Level: Protégé

Registered: 23-04-2008
Posts: 5

icon Printer.?

Im trying to write a module in Access using Printer.? and the Printer.? isnt regognized.

Printer.Font size
Printer.Print some text

Any tips or suggestions?

23-04-2008 at 11:12 PM
View Profile Send Email to User Show All Posts | Quote Reply
Keithuk
Level: Big Cheese


Registered: 02-11-2006
Posts: 19
icon Re: Printer.?

quote:
BobBarker wrote:
Im trying to write a module in Access using Printer.? and the Printer.? isnt regognized.

Printer.Font size
Printer.Print some text

Any tips or suggestions?


Printer.Print is the basic printing code that uses the default printer. It should work, what errors are you getting?

Its actually Printer.FontSize

____________________________
http://www.martin2k.co.uk/forums/

I've been programming with VB for 14 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
10-05-2008 at 01:05 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
Keithuk
Level: Big Cheese


Registered: 02-11-2006
Posts: 19
icon Re: Printer.?

quote:
BobBarker wrote:
Printer.Font size
Printer.Print some text


One thing I forgot to mension is

Printer.Print some text

Won't work

Printer.Print "some text"

will work.

You could always use the Debug.Print function to see what it would look like before printing.

Debug.Print "some text"

Then look in the Immediate Window to see the results.  

____________________________
http://www.martin2k.co.uk/forums/

I've been programming with VB for 14 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
11-05-2008 at 11:58 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
BobBarker
Level: Protégé

Registered: 23-04-2008
Posts: 5
icon Re: Printer.?

I have found that Printer.Print isnt supported in Excel or Access

11-05-2008 at 01:14 PM
View Profile Send Email to User Show All Posts | Quote Reply
Keithuk
Level: Big Cheese


Registered: 02-11-2006
Posts: 19
icon Re: Printer.?

quote:
BobBarker wrote:
I have found that Printer.Print isnt supported in Excel or Access

No Printer.Print is only supported in VB but you can tell it what to print.  

____________________________
http://www.martin2k.co.uk/forums/

I've been programming with VB for 14 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
11-05-2008 at 08:52 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
stickleprojects
Level: Moderator


Registered: 09-09-2002
Posts: 1025
icon Re: Printer.?

Hi
I'd recommend against writing your own printing module in Access - the reason being that it has on of the most powerful reporting engine I have ever seen built in.
But.. you can print onto the report canvas (me.print) in an event.
and you can print directly to the printer using GDI.
If you tell us more about what you want to achieve, we can probably come up with something more helpful

Regards
Kieron


____________________________
Build it better, faster, quicker, easier.. then fix it (non-offical MS mission statement)

12-05-2008 at 05:42 AM
View Profile Send Email to User Show All Posts | Quote Reply
BobBarker
Level: Protégé

Registered: 23-04-2008
Posts: 5
icon Re: Printer.?

Long Story Short:

I get 3 files from our customer. each file is about 3 megs. Within each file are specific topics.

I wrote a code back in the 90's that will bust these files up into the specific topis, with in specific folders, by months.

Then I have another code that a user uses to print a specific topic. To print a topic I have to put an escape code at the start of the print routine, so the text will fit on the page.

This code is
str$ - chr(27) + "&k2s"

This code was writen in QuickBasic (eeek)

Actualy the whole thing needs to be rewriten in VBA, but I dont have VBA or do I know much about it. Im using Access for the modules, with what VBA I do know.


12-05-2008 at 10:21 AM
View Profile Send Email to User Show All Posts | Quote Reply
stickleprojects
Level: Moderator


Registered: 09-09-2002
Posts: 1025
icon Re: Printer.?

ah..
suggest the following:

create a text file called "escape_prefix.txt" or something and put only the prefixed escape codes in it.
Then, the following commands :

copy escape_prefix.txt+myfile.txt mytgt.txt
print mytgt.txt

hoorah for DOS.



What version of Access are you running?


____________________________
Build it better, faster, quicker, easier.. then fix it (non-offical MS mission statement)

12-05-2008 at 05:00 PM
View Profile Send Email to User Show All Posts | Quote Reply
BobBarker
Level: Protégé

Registered: 23-04-2008
Posts: 5
icon Re: Printer.?


Yes that would work for file 1. Put the plot thickens

File 2

Has files we will call Items, within the Item file there are Recipes.  My old code would print the Item file, as it read it, line by line, finding the Recipes and the print them. The Recipes can have Recipes as well

Thus the need to print the file as it reads it.

I use Access and Excel 2002

12-05-2008 at 06:53 PM
View Profile Send Email to User Show All Posts | Quote Reply
stickleprojects
Level: Moderator


Registered: 09-09-2002
Posts: 1025
icon Re: Printer.?

Hmmm
Import the files into access
create a report to print them in a pretty way

To Import a text (delimited) file into access.
open the database
right click no the tables
get external data
change the file type to your file type and select your file
follow the onscreen prompt(s)
repeat for all files as necessary

i'll attempt to knock you up a database tomorrow when i'm near my proper pc.
Can you post up a couple of lines from each file?


____________________________
Build it better, faster, quicker, easier.. then fix it (non-offical MS mission statement)

12-05-2008 at 09:44 PM
View Profile Send Email to User Show All Posts | Quote Reply
BobBarker
Level: Protégé

Registered: 23-04-2008
Posts: 5
icon Re: Printer.?

The files are not realy formated for importing, but if you want to mess with it, I can send you several files.

email me at robert.barker@lsgskychefs.com  (I might be easier) the files on all on the work laptop



12-05-2008 at 10:19 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB General : Printer.?
Next Topic (Using an old .bas module) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Il portale per lui e lei | Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2008 Andrea Tincaniborder