Automating Label Printing From Access Db Random Printers
Hello all,
Currently we have in use an Access database which creates a record to be sent to our designated Bartender label for printing.
How it works is we have created a table in Access for our data to be stored, and each field is linked to the Bartender label, the record gets created as and when we need it, this is done via a delete query to empty the table, then an append query to add the record which needs printing to the table.
I managed to find in the forum somewhere how to set this up.
All works perfectly well..............ish
We print each label one at a time as they are all unique in random ways, but when printing the label (creating the record) we seem to be able to print to the default printer the majority of the time, then every now and then, it would come out on a different printer in the section.
There are four printers and six machines in the area which use this system, and the labels can come out of any one of them, even though they are not connected to the machine it was printed from.
It's almost as if when the job gets sent to the printer, another user has also printed a label and the label just 'follows' the other label out of the printer instead of coming out where it's supposed to
Does anyone have any experience of this?
Regards
Ryan
-
How exactly are you controlling BarTender?? Have you wrote some kind of automation script from within Access to control a BarTender process via the automation interface?? See the below white papers for details on what I'm referring to:
0 -
Legacy Poster
★ BarTender Hero ★
I've created the call to Bar Tender from within access by using the below coding. This snipet checks for a 64bit version of Windows first so it can use the correct unc to get to where Bar Tender is stored. The two queries are ran it that order to delete the record already in the temporary table used for printing, and replaces it with the record needing printing.
Public Function CreateLabels()
Dim RetVal As Variant
Dim lngReturn As LongDoCmd.SetWarnings False
DoCmd.OpenQuery "qryDeleteLabelRecord"
DoCmd.OpenQuery "qryCreateLabel"
DoCmd.SetWarnings True
Call IsWow64Process(GetCurrentProcess, lngReturn)If lngReturn = 0 Then
DoCmd.SetWarnings False
RetVal = Shell("C:\Program Files\Seagull\BarTender Suite\bartend.exe /F=\\10.170.99.9\General\BarTender\DirectPrint\Export\CustomerTri-WallLabel.btw /P /X")
Else
RetVal = Shell("C:\Program Files (x86)\Seagull\BarTender Suite\bartend.exe /F=\\10.170.99.9\General\BarTender\DirectPrint\Export\CustomerTri-WallLabel.btw /P /X")
End If
DoCmd.SetWarnings True
End FunctionSo instancing Bar Tender is done through the Shell command
Hope this makes sense?
0 -
I suggest you make an explicit call on the printer to use in your command line. For example: /PRN="HP LaserJet 2200D"
I would recommend that you look at the programmed automation solutions in the white papers I sent you as this will give you much better control and performance from your app.
0 -
Legacy Poster
★ BarTender Hero ★
I'll take a look into the automation solutions at some point
I'm not sure making an explicit call could work in our situation, as we have a number of users using multiple different printers. The idea behind the label is that it picks up the default printer, which, in theory should work, but it's as if Bar Tender is letting the call get intercepted somehow
Thanks for your help so far
Ryan
0 -
Legacy Poster
★ BarTender Hero ★
Ok im struggling with the syntax to make this work in Access (VB)
the white paper is in C# and although i can understand the logic etc, i just can't quite conquer it
I keep getting an 'object required' message every time i use this code
btFormat = btApp.Formats.Open("c:\\test.btw", false, "")
I've declared variables like so:
Dim btApp As BarTender.Application
Dim btFormat As BarTender.Format
Dim btMsgs As BarTender.Messagesjust for testing purposes i've got a blank form with one command button on it(in Access) to get it up and running
The code in the click event of the button is as above (btFormat = btApp.Formats.Open("c:\\test.btw", false, ""))
Thanks in advance
Ryan
0 -
There is a full reference in the BarTender Help system with numerous examples in both C# and VB.NET. Find this under the "Automating BarTender" topic.
0 -
"c:\\test.btw" is an invalid file path. It should be: "c:\test.btw"
0 -
Legacy Poster
★ BarTender Hero ★
VB.Net and VB6 are different though aren't they?
"C:\\test.btw" is the example given in your white sheet BarTenders Active X Automation Interface
I also tried the correct path and still it says 'object required'
Ryan
0 -
Did you create the application object? As in the BarTender process.
Dim btApp As BarTender.Application Set btApp = CreateObject("BarTender.Application") btApp.Visible = true
0 -
Legacy Poster
★ BarTender Hero ★
Hello,
Yes i think i'm declaring it right. I'm trying to create an instance of BarTender when my form loads, then as and when i want to print a label it's just a case of accessing the instance already created. The 'getobject' doesn't like working either..........
This is the code in my test form, it errors out on the .print line. I can get it to open a label, though the time it takes isn't any better than using the shell command, though if i can get it printing the app needed become visible so maybe time could be saved there
Let me know your thoughtd
Regards
Ryan
Public Sub Form_Load()
Dim btApp As BarTender.Application
End Sub
Public Sub Command0_Click()
Set btApp = CreateObject("BarTender.Application")
Dim btFormat As BarTender.Format
Set btFormat = btApp.Formats.Open("c:\test.btw", False, "")
Dim btMsgs As BarTender.MessagesbtFormat.Print ("Job1")
btApp.Visible = True
End Sub
0 -
Legacy Poster
★ BarTender Hero ★
I'm getting closer but still can't print as 'object doesn't support this property or method'
Option Compare Database
Option ExplicitDim btApp As BarTender.Application
Dim btFormat As BarTender.Format
Dim btMsgs As BarTender.MessagesPublic Sub Command0_Click()
Set btFormat = btApp.Formats.Open("c:\test.btw", False, "")
btApp.Visible = True
btFormat.Print "Job1", True, -1, btMsgs
End Sub
Public Sub Form_Load()
Set btApp = CreateObject("BarTender.Application")
End Sub
Any more thoughts on the final steps?
Regards
Ryan
0 -
Which line of code is it failing on?
I've not touched VB6 in a long time, but here's an example from the archives.
The following Visual Basic example shows how to change the product name and id on the Demo.btw label format and then print it. In particular, use the PrintOut() method rather than the Print() method you've used thus far.
'Declare object variables Dim btApp As BarTender.Application Dim btFormat As BarTender.Format 'Start the Bar Tender application Set btApp = CreateObject("BarTender.Application") btApp.Visible = true 'Open the Demo.btw format file to print to a laser printer Set btFormat = btApp.Formats.Open("c:\Demo.btw",False,"HP LaserJet 2200") 'Set the product name and id on the label. btFormat.SetNamedSubStringValue "ProductName", "Bar Tender Integration Edition" btFormat.SetNamedSubStringValue "ProductId", "BtInt98234" 'Print the label btFormat.PrintOut btApp.Quit
0 -
Legacy Poster
★ BarTender Hero ★
Ha, great work Ian,
it was erroring on btFormat.Print
All that was holding me back was that..........so now it's bt.Format.PrintOut it works fine!!
Thanks alot for your help
Regards
Ryan
0
請登入寫評論。
評論
13 條評論