Results 1 to 3 of 3

Thread: code issue

  1. #1
    Join Date
    Dec 2010
    Location
    Manchester
    Posts
    24

    Unanswered: code issue

    hey guys,

    iv been having a little trouble with a little code i have written in my MDB project.
    all i want this to do is print a selected ammount of invoices, unfortunatley it keeps printing the first one out for each number selected, say i sellect 5 it will print the first invoice 5 times!

    Heres my code:

    Private Sub BtnListInvoice_Click()
    Dim sql As String, sqld As String, sqlEx As String, sqls As String

    sql = "AND (invoiceid =" & LstInvoice & ")"


    For Each varitem In LstInvoice.ItemsSelected
    DoCmd.OpenReport "rpt_acc_PUR_INVOICE_5", , , "invoiceid = " & LstInvoice.Column(0)
    'PrintReport "rpt_acc_PUR_INVOICE_5", invoiceid = " & LstInvoice.Column(0)"
    Loop
    End Sub

  2. #2
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    I quickly checked some of my code and I think you need to change this line:

    DoCmd.OpenReport "rpt_acc_PUR_INVOICE_5", , , "invoiceid = " & LstInvoice.Column(0)

    to:

    DoCmd.OpenReport "rpt_acc_PUR_INVOICE_5", , , "invoiceid = " & LstInvoice.Column(0,varitem)

  3. #3
    Join Date
    Dec 2010
    Location
    Manchester
    Posts
    24

    thank you

    your code worked great thank you for the help!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •