Serial Port Printing in VBA (1 Viewer)

tbca-mps

New member
Local time
Today, 07:21
Joined
Jun 7, 2011
Messages
1
I have built a small application in Access and VBA that acts as a SATO label printer. When I first turn the program on, I get an error:

FRAMING ERROR

I then have to power cycle the printer, and run a program called SeeIt.exe (third party program for raw printing). This program shows if the printer is online. To me, it looks like it polls the serial port to open the connection first. I can then open Access, and printing runs as required.

How can I get VBA to open this first so that my users can just start printing.

Thanks in advance.

Here is the code that executes in VB when the button is pushed.

Code:
Private Sub cmdCreateCarpet_Click()
Dim num As Integer
 
Dim db As Database
Dim rs As DAO.Recordset
Dim qdf As QueryDef
Dim lblprnt As String

Set db = CurrentDb
Set qdf = db.QueryDefs("qryCarpetLabel")
Set rs = qdf.OpenRecordset()

num = 0
Do
num = num + 1
    DoCmd.RunCommand acCmdSaveRecord
    seq = seq + 1
    If seq = 10000 Then
    seq = 1
    End If
  Open "Com1:57600,n,8,1" For Output As #1
  Print #1, "AV30H15FW0303V550H570V240H15FW03H570V390H15FW03H570V30H340FW03V360V75H50P5$A,150,120,0$=" & inhouse & "V240H20$A,40,25,0$=DateV240H345$A,40,25,0$=ShiftV35H20$A,40,25,0$=InHouseV35H345$A,40,25,0$=SequenceV98H360P5$A,100,75,0$=" & Format(seq, "0000") & "V280H50P5$A,100,75,0$=" & Format(prntdate, "yymmdd") & "V280H425P5$A,100,75,0$=" & shift & "V450H60BG02070>G" & kanban & "V530H85L0101XM   " & kanban & "Q01Z"

 Close #1

Loop Until num = txtCopies


End Sub
 

JamesMcS

Keyboard-Chair Interface
Local time
Today, 15:21
Joined
Sep 7, 2009
Messages
1,819
The Shell command allows you to run programs in VBA, maybe you could use that to run SeeIt before printing starts?
 

Users who are viewing this thread

Top Bottom