Gustav Brock
Gustav at cactus.dk
Wed May 16 02:19:35 CDT 2007
Hi Larry That is not curious. You are writing to a device - or more precisely a device file: http://en.wikipedia.org/wiki/Device_file as if you were writing to a file. To write to an IP address is completely different. You need a protocol and a port and to take care of all the exceptions and possible errors. It can be done. A place to start is to study the Microsoft Winsock Control. Filename: mswinsck.ocx. /gustav >>> lmrazek at lcm-res.com 16-05-2007 00:07 >>> Hi Lambert: It is actually the other way around, or I didn't write out the example correctly: This works (with UNC name): Open "\\HPLaptop\HPOFFICEJET" For Output As #1, Print #1, PrtStr Close This doesn't (directly to IP address: Open "10.0.2.22" For Output As #1, Print #1, PrtStr Close (no lights, sounds ... Nothing) Curiously, if I map an LPT port to the printer, it works. Do I need to specify the port for the TCP/IP comm? I've been trying to find a reference for these commands, but haven't had any luck. Larry Mrazek LCM Research, Inc. www.lcm-res.com lmrazek at lcm-res.com ph. 314-432-5886 mobile: 314-496-1645 -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert Sent: Tuesday, May 15, 2007 8:20 AM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Sending text direct to printer, take 2 When you say nothing happens with... Open "\\HPLaptop\HPOFFICEJET" For Output As #1, Print #1, PrtStr Close Do you see any lights blinking on the printer? If you do this would suggest that data is getting to the printer. In which case it might just be waiting for a from feed character to make it throw the page. So try... Print #1, YourDataString & chr(12) !!! I just noticed you are printing to file handle #1. Aren't handles 0, 1 and 2 reserved for stdin, stdout and strderr? What about... Dim ph as Long ph = Freefile Open "\\HPLaptop\HPOFFICEJET" For Output As #ph Print #ph, PrtStr Close #ph ??? Lambert -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Lawrence Mrazek Sent: Tuesday, May 15, 2007 8:27 AM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Sending text direct to printer, take 2 I've tried that, but nothing happens ... I'm wondering if there is some additional criteria I need to make it work ... Haven't been able to find any good reference material on this technique. I got it to work yesterday by sharing out the network printer on my machine, then mapping the share to a LPT port. I'd rather not do this. Larry Mrazek LCM Research, Inc. www.lcm-res.com lmrazek at lcm-res.com ph. 314-432-5886 mobile: 314-496-1645 -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan Sent: Monday, May 14, 2007 4:13 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Sending text direct to printer, take 2 Don't know if it will work, but I'd try creating a "Standard TCP/IP Port" for the network machine's IP address and printing to that. On 14 May 2007 at 16:47, Lawrence Mrazek wrote: > > > Hi: > > Thanks to Gustav, I have some code that works on my local machine ... > however, I'll need to print to an IP address, and I haven't been able > to find the syntax. > > This Works: > Dim PrtStr As String > PrtStr = "Printer Test Text llllllllllllllllllllllllllllllllllll" > Open "\\HPLaptop\HPOFFICEJET" For Output As #1 rint #1, PrtStr Close > #1 > > This doesn't (no errors, basically nothing) Dim PrtStr As String > PrtStr = "Printer Test Text llllllllllllllllllllllllllllllllllll" > Open "10.0.2.22" For Output As #1 > Print #1, PrtStr > Close #1 > > Anyone have any ideas? > > Thanks in advance. > > Larry Mrazek > lmrazek at lcm-res.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com -- Stuart -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com