Print report several times by changing field information

kiler40

New member
Local time
Today, 04:44
Joined
Apr 7, 2015
Messages
7
Hello Access Professionals!
I have a question related with a report i`m using to print labels.
I`m not familiar with Access and this is quite a challenge to do it alone.

In the attached file there is a report called "MICRA"
when started it asks that you want to select (default is 1 and special select in this case is 11) and next it asks "SPS"
the value entered there is printed in the bottom right corner of the report.
My question is is it possible if in the SPS field is entered a special value (for example "MASS") to print 30 labels of each selected label with text in this fiels = "val.1"; 15 with text in the field = "val.2"; 10 with "val.3" and 10 with "val.4" and after that to print next label with same rules...
And if not entered "MASS" to print just 4 copies of every label.

I hope it is not too complicated.
I think it can be done by some coding... but i really don`t understand anything about access. :(

Thanks in advance for the help!
 

Attachments

I got you until the end there, but here is a setup that might work if you use a form to load this process.

Code:
Private Sub LoadReportName()
    ' For loop
    Dim i As Integer
    
    ' Parameters
    Dim paramA As String: paramA = InputBox("Prompt Message A", "Title", "Default Value")
    Dim paramB As String: paramB = InputBox("Prompt Message B", "Title", "Default Value")
    
    ' (B) KeyWord Match List
    Dim listB(29) As String
        listB(0) = "0":     listB(1) = "1":     listB(2) = "2"
        listB(3) = "3":     listB(4) = "4":     listB(5) = "5"
        listB(6) = "6":     listB(7) = "7":     listB(8) = "8"
        listB(9) = "9":     listB(10) = "10":   listB(11) = "11"
        listB(12) = "12":   listB(13) = "13":   listB(14) = "14"
        listB(15) = "15":   listB(16) = "16":   listB(17) = "2"
        listB(18) = "18":   listB(19) = "19":   listB(20) = "20"
        listB(21) = "21":   listB(22) = "22":   listB(23) = "23"
        listB(24) = "24":   listB(25) = "25":   listB(26) = "26"
        listB(27) = "27":   listB(28) = "28":   listB(29) = "29"
        
    If Len(paramA & vbNullString) > 0 And _
       Len(paramB & vbNullString) > 0 Then
    
        If paramB = "KeyWord" Then
        
            For i = 0 To 29
                DoCmd.OpenReport "rptReportName", acViewPreview, "paramA = """ & paramA & """, paramB = """ & listB(i) & """"
            Next
        
        Else: DoCmd.OpenReport "rptReportName", acViewPreview, "paramA = """ & paramA & """, paramB = """ & paramB & """"
        End If
    
    Else: MsgBox "Invalid Parameters"
    End If
    
End Sub
 
@BlueIshDan, just wondering why is there a need for an Array? When the loop can use the value of i?
 
Sorry for the stupid question, but what to do with this ?
I really have no idea how coding and access work together.
I don't want to be offensive! Thanks so far for the time spend, but i think i need a little more help here. What form to use to load the process ?

I havent made the file. I barelly managed to create the report called "MICRA" because the other one (cheated by some former colleague) was not printing on the micra printer.
Really Sorry for the stupid questions...
 
Its honestly for the next developer to use as a template. I would do it all for you but I don't have the time ^_^
 
Ok :) i understand!
Thanks for the hints.
Hope some one can help to complete the task :)
 

Users who are viewing this thread

Back
Top Bottom