Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21096

[ODBC Driver Manager] Data source name not found and no default driver specified

$
0
0
Need your help:


Code:

Private Sub btnPrint_Click()
   
    Dim reqnbr          As String
    Dim category        As String
    Dim jcode          As String
    Dim part            As String
    Dim printdate      As String
    Dim chktick        As String
    Dim chkdiff        As String
    Dim x              As Integer
    Dim iResponce      As Integer
    Dim iConfirm        As Integer
    Dim reqno_list      As String
   
    global_domain = "meditop"
           
    Set connup = New ADODB.Connection
    connup.ConnectionString = "DSN=labelprint_update; UID = pub; PWD = public"
    connup.ConnectionTimeout = 30
    connup.Open
   
    printdate = Format(Now, "mm/dd/yy")
       
    If (fgLabelDetail.Visible = False) Then
        msg = MsgBox("Does not have any label to print.", vbInformation, "Not Label Require to Print")
    Else
        chkdiff = "N"
        chktick = "N"
        'Check if different category is selected
        x = 0
       
        For I = 1 To cBar
            With fgLabelDetail
                .Row = I: .Col = 0: .CellPictureAlignment = 4
                If (.CellPicture = picChecked.Picture) Then
                    chktick = "Y"
                   
                    If x = 0 Then
                        category = fgLabelDetail.TextMatrix(.Row, 7)
                        x = x + 1
                    End If
                   
                    'compare category
                    If category <> fgLabelDetail.TextMatrix(.Row, 7) Then
                        chkdiff = "Y"
                    End If
                   
                    category = fgLabelDetail.TextMatrix(.Row, 7)
                   
                    reqno_list = (reqno_list + vbNewLine + "Request Nbr: " + fgLabelDetail.TextMatrix(.Row, 1) + _
                                  vbTab + "Lot No: " + fgLabelDetail.TextMatrix(.Row, 4) + vbTab + "Label Type: " + _
                                  fgLabelDetail.TextMatrix(.Row, 7))
                End If
            End With
        Next
       
        If chktick = "N" Then
            msg = MsgBox("Either one label is selected to be print.", vbInformation, "Label Require")
        Else
            If chkdiff = "N" Then
               
                iConfirm = MsgBox("Are you sure to print below label?" & vbNewLine _
                                  & reqno_list, vbYesNo, "Label Print Confirmation")
               
                If iConfirm = vbYes Then
                    For I = 1 To cBar
                        With fgLabelDetail
                            .Row = I: .Col = 0: .CellPictureAlignment = 4
                            If (.CellPicture = picChecked.Picture) Then
                               
                                reqnbr = fgLabelDetail.TextMatrix(.Row, 1)
                                part = fgLabelDetail.TextMatrix(.Row, 2)
                                jcode = fgLabelDetail.TextMatrix(.Row, 3)
                                category = fgLabelDetail.TextMatrix(.Row, 7)
                               
                                Call print_label(reqnbr, part, jcode, category)
                               
                                connup.Execute "Update xbrd_det Set xbrd_status = 1, xbrd_print_date = '" & printdate & "', xbrd_st_type = 'printed' Where xbrd_domain = '" & global_domain & "' and xbrd_req_nbr = '" & reqnbr & "' and xbrd_category = '" & category & "'"
                               
                               
                            End If
                        End With
                    Next
                    load_labelinfo_unpick
                End If
               
            Else
               
                iConfirm = MsgBox("Are you sure to print below label?" & vbNewLine _
                                  & reqno_list, vbYesNo, "Label Print Confirmation")
               
                If iConfirm = vbYes Then
               
                    iResponce = MsgBox("Make sure is using correct label to print.", vbYesNo, "Label Confirmation")
                   
                    If iResponce = vbYes Then
                        For I = 1 To cBar
                            With fgLabelDetail
                                .Row = I: .Col = 0: .CellPictureAlignment = 4
                                If (.CellPicture = picChecked.Picture) Then
                                   
                                    reqnbr = fgLabelDetail.TextMatrix(.Row, 1)
                                    part = fgLabelDetail.TextMatrix(.Row, 2)
                                    jcode = fgLabelDetail.TextMatrix(.Row, 3)
                                    category = fgLabelDetail.TextMatrix(.Row, 7)
                                   
                                    Call print_label(reqnbr, part, jcode, category)
                                   
                                    connup.Execute "Update xbrd_det Set xbrd_status = 1, xbrd_print_date = '" & printdate & "', xbrd_st_type = 'printed' Where xbrd_domain = '" & global_domain & "' and xbrd_req_nbr = '" & reqnbr & "' and xbrd_category = '" & category & "'"
                                   
                                End If
                            End With
                        Next
                       
                        load_labelinfo_unpick
                    End If
                End If
               
            End If
        End If
       
    End If
   
    connup.Close

End Sub

I really can't find out what wrong i did, please help.

Viewing all articles
Browse latest Browse all 21096

Trending Articles