|
-
Jun 12th, 2006, 09:50 AM
#1
Thread Starter
New Member
Print to COM1 with ActiveX???
Hi,
Before I explain my problem I will give a little background on the situation.....
We have a stock database that runs in access 97, we have 4 PC's that print out barcodes to barcode printers that run on COM 1. The 4 PC's where running Win NT 4 and working fine...until we decided to replace the PC's with new Dell's running Win XP. We can't get access to print to the COM port so I have been tasked with writing an active X control in VB that we can place on a form in access that will send the data from access in a string to the control and the control will then print to the barcode printer on COM 1.
I am a beginner at VB with a single VB book (and not a paticuarly good on at that! ) but im having a go
So far this is the code I have for my active x control
Option Explicit
Dim VarPin As String
Dim VarTQ As String
Dim VarBox As String
Dim V*****ch As String
Dim VarFreeText As String
Public Sub Prnt()
Open "COM1" For Output As #1
Print #1, "NTLCODE"
Print #1, VarPin
Print #1, VarTQ
Print #1, VarBox
Print #1, V*****ch
Print #1, VarFreeText
Close #1
End Sub
Public Property Let Pin(PinX As String)
VarPin = PinX
End Property
Public Property Let TQ(TQX As String)
VarTQ = TQX
End Property
Public Property Let Box(BoxX As String)
VarBox = BoxX
End Property
Public Property Let Batch(BatchX As String)
V*****ch = BatchX
End Property
Public Property Let FreeText(FreeTextX As String)
VarFreeText = FreeTextX
End Property
Private Sub UserControl_Initialize()
End Sub
NTLCODE is the BASIC code that the printer uses, VarPin, VarTQ etc are the different parts of the barcode that is printed.
When I run the code it will compile but it wont initialize the printer, I have already written code in VB on a standard exe form that can control the printer but im finding transferring that into active x to be a little difficult..
Anyones help would be very much appreciated
(im not after anyone to write the code for me, just a general idea of the direction I should be taking would be great ! )
Thanks
Ian
-
Jun 14th, 2006, 02:53 PM
#2
Re: Print to COM1 with ActiveX???
Use the MSComm control (include the Microsoft Comm Control under Project/Components). Just put it on your form, then use the Help for the control - you can pretty much copy the example code, change the speed, port number, etc., and use it.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
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
|