Print to Label Maker (Library Problem)

Adam McReynolds

Registered User.
Local time
Yesterday, 18:27
Joined
Aug 6, 2012
Messages
129
I created this label print button in my database and it worked fine. Now when I put it on the app server at work it has a problem with this code:
Code:
Dim ObjDoc As bpac.Document

It says it cannot find it. In my first working database it has this "bpac" library in the database as when I type the ".Document" portion it shows up. Now I had to download this SDK folder from the Brother website and did everything the same for the second database. I copied this code from one of their sample DB's for the first DB and it worked fine. I am wondering what I need to do to get this bpac in the library on my new database.

Any suggestions or ideas?


Here is the code:
Code:
Option Explicit

' Data Folder
Const sDataFolder = "C:\Program Files\Brother bPAC3 SDK\Templates\"

'*******************************************************************
'   Print Label Module
'*******************************************************************
Private Sub PrintLabel_Click()
On Error GoTo Err_PrintLabel_Click
    Dim ObjDoc As bpac.Document
    Set ObjDoc = CreateObject("bpac.Document")
    Dim strFilePath As String
    strFilePath = sDataFolder & "CoxSD.lbx"
    If (ObjDoc.Open(strFilePath) <> False) Then
    
        ' Text
        ObjDoc.GetObject("objComments").Text = Form_FRM_RF_COX_DATA.work_comments.Value
        ObjDoc.GetObject("objSerialNumber").Text = Form_FRM_RF_COX_DATA.incoming_module_sn.Value
        ObjDoc.GetObject("objCustomer").Text = Form_FRM_RF_COX_DATA.end_user.Value
        ObjDoc.GetObject("objProblem").Text = Form_FRM_RF_COX_DATA.problem_description.Value
        ObjDoc.GetObject("objComplete").Text = Form_FRM_RF_COX_DATA.complete_date.Value
        
        ' ObjDoc.SetMediaById ObjDoc.GetMediaId(), True
        ObjDoc.StartPrint "", bpoDefault
        ObjDoc.PrintOut 1, bpoDefault
        ObjDoc.EndPrint
        ObjDoc.Close

    End If
    Set ObjDoc = Nothing

Exit_PrintLabel_Click:
    Exit Sub

Err_PrintLabel_Click:
    MsgBox Err.Description
    Resume Exit_PrintLabel_Click

End Sub
 
Did you ensure that the reference is enabled under Tools | References? The name should be something like "Brother b-Pac 3.0 Type Library."
 
Did you ensure that the reference is enabled under Tools | References? The name should be something like "Brother b-Pac 3.0 Type Library."

Yeah that was it. Found it like 2 seconds after I posted this. I spent 2 hours already with this problem. haha. Thank you so much. People like you make the world go round. Cheers!
 

Users who are viewing this thread

Back
Top Bottom