Thursday, April 9, 2015

10:22:00 AM
Trick Print current record in ms access

Is easy code

Example The Button Name is   Print_barcode  Click and add to viewer code just  simple
Usually only add this          'strCriteria = "[ID]='" & Me![ID] & "'" 
 The blue color will add the code in yellow palce detail:

example My Number  the primariky name  is  ID



Private Sub Print_barcode_Click()

    Dim strReportName As String
    Dim strCriteria As String

    If NewRecord Then
        MsgBox "This record contains no data. Please select a record to print or Save this record." _
             , vbInformation, "Invalid Action"
        Exit Sub
    Else
        strReportName = "Select Barcode"
        strCriteria = "[ID]= " & Me![ID]
        'strCriteria = "[ID]='" & Me![ID] & "'"

        DoCmd.OpenReport strReportName, acViewPreview, , strCriteria

    End If
End Sub

0 comments:

Post a Comment