Question : Write Data to a Serial Port

I have a field on a Access Form called "txt1" which I want to send over the serial port to a VideoJet Printer.  I am unable to use the built-in control in access so I am having to program it in VB code.  Any idea on how to accomplish this.  Any help would be appreciated.

Answer : Write Data to a Serial Port

Something like this might do the trick:

Public Sub Foo()
     
     Dim x As Integer
     Dim intChannel As Integer  'The channel to communicate thru
     Dim strDestination As String  'PORT or Filename to interact with
     
     For x = 1 To 511
         Close #x
     Next x
     
     intChannel = FreeFile()
     strDestination = "COM1"   'the COM1 port
     
     Open strDestination For Output As #intChannel
         Print #intChannel, "TESTING 12345"
     Close #intChannel
     
 End Sub

In the above code, the string "TESTING 12345" is being sent to the COM port (I *think*) ... I have NOT tested this code ....

In addition ... this article:
http://www.granite.ab.ca/access/serialport.htm

may prove to be quite helpful in this area of COMM port communications, especially the link titled "Perform Serial Port Communication" ... that particular article is VB based, but it should all work just fine in VBA/Access.
Random Solutions  
 
programming4us programming4us