Barcoding from Access
Barcoding from Access
(OP)
I want to print pricing barcodes from Access 2000. I have done a make table query to supply the data for a program called BarTender from Seagul. I want to be able to print the batch of barcodes in one go (hence the table) and then dump the data using a button on a form. Everything works fine, barcodes batch properly etc, and I can print them but when I return back to Access, I get the error message 438 that the object or method is not supported. How do I get rid of the error message. The code is: the last line is where it falls down (but it works anyway). Seagull supply an automation control which I have put in my references.
Private Sub Command115_Click()
Dim stDocName As String
stDocName = "Barcode"
DoCmd.RunMacro stDocName
Dim btApp As BarTender.Application
Set btApp = CreateObject("BarTender.Application")
Dim btFormat As New BarTender.Format
btApp.Visible = True
btFormat = btApp.Formats.Open("C:\My Documents\BarTender\Formats\bunnings.btw", False, "")
End Sub
I may have the wrong peice of code, as I used code form a VB.Net example.
Any ideas?
Private Sub Command115_Click()
Dim stDocName As String
stDocName = "Barcode"
DoCmd.RunMacro stDocName
Dim btApp As BarTender.Application
Set btApp = CreateObject("BarTender.Application")
Dim btFormat As New BarTender.Format
btApp.Visible = True
btFormat = btApp.Formats.Open("C:\My Documents\BarTender\Formats\bunnings.btw", False, "")
End Sub
I may have the wrong peice of code, as I used code form a VB.Net example.
Any ideas?
RE: Barcoding from Access
code added to yours is in red
CODE
On Error goto Err_Command115
stDocName = "Barcode"
DoCmd.RunMacro stDocName
Dim btApp As BarTender.Application
Set btApp = CreateObject("BarTender.Application")
Dim btFormat As New BarTender.Format
btApp.Visible = True
btFormat = btApp.Formats.Open("C:\My Documents\BarTender\Formats\bunnings.btw", False, "")
Exit_Command115:
Exit sub
Err_Command115:
Select case err.number
' case #### 'this is where your error number will go
case else
MsgBox "Error # " & Err.Number & " " & Err.Description, vbInformation, "In sub Command115"
End Select
Resume Exit_Command115
End sub
Notice the REM character in front of Case ####
The first time you add this code and run it, a error box will pop up with the Error number. Note the Error number .
Then come back un-REM the Case #### put that number in place of #### and run it again.
It should go on though with out a hitch unless it’s deeper internal than can be trapped here.
DougP, MCP, A+
RE: Barcoding from Access
I'll give it go.
Dave
RE: Barcoding from Access
DougP, MCP, A+
RE: Barcoding from Access
I got it from my code snippets I saved
just replace the Command115 with the name of the command button everywhere it exists. In any Sub or function for that matter.
Replace the CASE xxxx with whatever number you need to trap
also you can do other stuff with it as well.
When I'm debugging I also REM out the Exit like so
CODE
DougP, MCP, A+
RE: Barcoding from Access
I got some VB6 code examples from Seagull, and I've got it working properly now. I needed to load BarTender in the background on Form Load, to make it work.
Have a great New Year
Dave
RE: Barcoding from Access
Label select statement:
SELECT DISTINCT NurseryLibData.UPCode, NurseryLibData.CommonName, NurseryLibData.ItemName, NurseryLibData.BriefDescription, NurseryLibData.UnitPrice, NurseryLibData.[Sign line 3], NurseryLibData.[Sign line 4], NurseryLibData.[Sign line 5], NurseryLibData.[Sign line 6], NurseryLibData.[Sign line 7], NurseryLibData.[Sign line 8], NurseryLibData.QtySticky, NurseryLibData.Soil, NurseryLibData.Water
FROM NurseryLibData
WHERE (((NurseryLibData.QtySticky)>0))
ORDER BY NurseryLibData.ItemName;
Code behind button on form:
Dim stAppName As String
stAppName = "C:\Progra~1\BarTen~1\bartend.exe /f=C:\Progra~1\BarTen~1\Accesslb\LABEL1.btw/FP/X"
Call Shell(stAppName, 1)
RE: Barcoding from Access
I appricate any help that you can provide me.
Thanks,
David