dbTalk Databases Forums  

Print only a string

comp.databases.ms-access comp.databases.ms-access


Discuss Print only a string in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Marc
 
Posts: n/a

Default Print only a string - 03-05-2010 , 04:50 AM






Hi,

I want to print only a string but I can't find the method.

My code is:

Dim s as String
Dim p As Printer

For Each p In Printers
If p.DeviceName = "\\Recepcion02\ZDesigner LP 2824" Then
Set Printer = p
Exit For
End If
Next

s = code.Value

Printer.Print s

This last command fails.

thanks for the help.

Marc

Reply With Quote
  #2  
Old   
Tom van Stiphout
 
Posts: n/a

Default Re: Print only a string - 03-05-2010 , 08:40 AM






On Fri, 5 Mar 2010 01:50:22 -0800 (PST), Marc <negu.marc (AT) gmail (DOT) com>
wrote:

I would think this does not even compile. Try this:
Dim s as String
Dim p As Printer
For Each p In Printers
If p.DeviceName = "\\Recepcion02\ZDesigner LP 2824" Then
Exit For 'p now refers to your printer
End If
Next
s = code.Value
p.Print s 'Use this printer to print.

-Tom.
Microsoft Access MVP


Quote:
Hi,

I want to print only a string but I can't find the method.

My code is:

Dim s as String
Dim p As Printer

For Each p In Printers
If p.DeviceName = "\\Recepcion02\ZDesigner LP 2824" Then
Set Printer = p
Exit For
End If
Next

s = code.Value

Printer.Print s

This last command fails.

thanks for the help.

Marc

Reply With Quote
  #3  
Old   
Marc
 
Posts: n/a

Default Re: Print only a string - 03-05-2010 , 09:30 AM



With your modification occurs the same problem. The line p.Print s
shows me an error that this object dont admitt this property or
method.
I'm not sure if it's posible to print a string. Maybe I have to
reserve and standard output and print like a shell.

knows somebody more from that?

thanks for the help.

Marc

Reply With Quote
  #4  
Old   
Salad
 
Posts: n/a

Default Re: Print only a string - 03-05-2010 , 12:47 PM



Marc wrote:

Quote:
With your modification occurs the same problem. The line p.Print s
shows me an error that this object dont admitt this property or
method.
I'm not sure if it's posible to print a string. Maybe I have to
reserve and standard output and print like a shell.

knows somebody more from that?

thanks for the help.

Marc
Years ago one could do something like
Open "LPT1" For Output As #1
Print #1, "Text"
Close #1
and could write to Com1 and Com2 as well. I haven't seen those commands
used in Windows. Perhaps you could run the code from Dos but gw-basic
isn't distributed with Windows anymore...you'll have to find another
program.

Here's a link to explore if you'd like
http://mc-computing.com/Languages/SerialIO.htm

I'm not sure what the p.print s line would do. The printers collection
lets you list the printers in the collection and perhaps set the margins
and other properties of the printer object. I don't see any "print"
method or property.

Reply With Quote
  #5  
Old   
Stuart McCall
 
Posts: n/a

Default Re: Print only a string - 03-05-2010 , 01:53 PM



"Marc" <negu.marc (AT) gmail (DOT) com> wrote

Quote:
With your modification occurs the same problem. The line p.Print s
shows me an error that this object dont admitt this property or
method.
I'm not sure if it's posible to print a string. Maybe I have to
reserve and standard output and print like a shell.

knows somebody more from that?

thanks for the help.

Marc
You can give this a try:

http://www.smccall.demon.co.uk/Downloads.htm#LinePrint

It provides character mode printing to a named printer, either local to the
pc or across the network. To incorporate it into your app, simply import the
class module and use the supplied demo to guide your coding.

hth

Reply With Quote
  #6  
Old   
Marc
 
Posts: n/a

Default Re: Print only a string - 03-08-2010 , 02:54 AM



ok thanks,

I will try your recommendations.

thanks for the help.

Marc

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.