Printing Form for Multiple or Single Reports

tl mike

Registered User.
Local time
Today, 13:49
Joined
Sep 7, 2007
Messages
117
I am working on a db for promo items we send out from time to time right now we type up everything with a type writer wich I would like to make a db to do the printing for us and in the long run save the information for us for later use if needed.

My problem is setting up the print form
1. I cant get it to print the current record only if I have it selected
2. I cant get it to select yes on the items that were printed for both labels and memos
3. I havent been able to get it to print a label yet.

Any insight will be greatly appreciated!!
 

Attachments

Forms aren't designed with printing in mind, create and use Reports
 
I am using a report for both the labels and the memo.

What I have is a form to enter the info, then you click on the print button which brings up another form in which you select if you want to print the current record only or all records plus if you want to print the labels and how many labels to skip. Which right now the printing form is not performing I have spent a couple hours already trying to get it to work and with very little success.
 
Heres the code for the print form and you can also see the db in the attachment on my first post to help get a better feel for what I am trying to do.


Code:
Option Compare Database
Option Explicit

Private Sub Form_Open(Cancel As Integer)
'This code executed as soon as Print Orders and Labels from Form opens.
    LabelsToSkip.Enabled = True
    SpinUpButton.Visible = True
    SpinDownButton.Visible = True
End Sub

Private Sub LabelOption_AfterUpdate()
    If LabelOption = 3 Then
            LabelsToSkip.Enabled = False
            SpinUpButton.Visible = False
            SpinDownButton.Visible = False
        End If
        If LabelOption <> 3 Then
            LabelsToSkip.Enabled = True
            SpinUpButton.Visible = True
            SpinDownButton.Visible = True
        End If
End Sub

Private Sub PrintFromOrderForm_Click()
    Dim filterCondition As String, Reply As Integer, msg As String, x As Byte
    
    'Default filter is Current Record Only".
    filterCondition = "frmPrintfromOrder.PromoPackPK=" & CLng(Me.PromoPackPK)
    
    'First do the order options.
    If OrderOption < 3 Then 'Order option 3 is Don't Print Any Invoices Receipts.
        If OrderOption = 2 Then     'If second Invoice/Receipt Option selected...
            filterCondition = "Not [MemoPrinted]" '...change filter to "Unprinted invoices/receipts.
        End If
        'Print the Invoices and receipts with appropriate filter condition.
    DoCmd.OpenReport "PromoPackMemo", acPreview, "", "", acNormal
        
        'Ask, and make invRecPrinted True if user clicks the Yes button.
    Dim Message, Buttons, Choice
      Message = "Are you sure you want to complete this order?"
      Buttons = vbYesNo
      Choice = MsgBox(Message, Buttons)
      
      If Choice = vbYes Then
    [tblPromoPack].[MemoPrinted] = True
      
      If Choice = vbNo Then
        Exit Sub
  
        
    'Now on to selected label options.
    If LabelOption < 3 Then
        If LabelOption = 2 Then 'If All Unprinted Labels selected...
            filterCondition = "Not [LabelPrinted]" '...set filter to unprinted labels.
        End If
    
        'Put up a reminder about loading labels. Accept Cancel to bail out.
        msg = "Please load labels into printer, then click OK."
        If MsgBox(msg, vbInformation + vbOKCancel, "Printer") = vbCancel Then
            Exit Sub
        End If
            End If
            End If
            End If
            End If
End Sub
'Code for spin buttons (up). Button is a command button
'with a little bitmap image of an up-pointing arrow.
Function Print_from_Order_Form_Macros_SpinUp()
    LabelsToSkip = LabelsToSkip.Value + 1
End Function


Private Sub CancelPrint_Click()
    DoCmd.Close acForm, "frmPrintfromOrder", acSaveNo
End Sub
 
TL_Mike:

Made a couple of modifications.
--Your filter was a littel "jacked up"
--You must create a recordset before updating the "MemoPrinted" field.

See attachment
 

Attachments

Users who are viewing this thread

Back
Top Bottom