Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Barcoding from Access 1

Status
Not open for further replies.

Dav43

Technical User
Mar 9, 2001
11
AU
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?
 
trap an error like so
code added to yours is in red
Code:
Private Sub Command115_Click()
[COLOR=red]On Error goto Err_Command115[/color]
    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, "")
[COLOR=red]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
[/color]
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+
 
Thanks for your help Doug,

I'll give it go.

Dave
 
No Probs man, thanks for the star !!!

DougP, MCP, A+
 
BTW keep this Red code handy it works everywhere.
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:
Resume [b][COLOR=red]'[/color][/b] Exit_Command115
then it will resume right to the line that has the problem and you can interrogate it further


DougP, MCP, A+
 
Thanks for the tip and your help Doug, Much appreciated.

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
 
I just have a button on the form and call BarTender. The label (LABEL1.btw) is designed to look at the access table via Odbc with a select statement.

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)
 
I am working on an Inventory VB.net program that requires me to print barcodes by passing argument(barcode number) to a SUB to print barcode. I can create .btw file but I need to print the barcode number that is passed down form the main program to the sub which Command115_Click() in this case. How do I make the barcode number in the .btw to be a variable? How do I use the vbscript in the Modify Selected Barcode Object screen?

I appricate any help that you can provide me.
Thanks,
David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top