Hello everybody, I'm new to this forum, so sorry if i post something that has been already answered althought i couldn't find it in search. Anyway, there it goes:
i have a search system which gives you the values you search for in a list box. The list box has its "Multi Select" property set to "Extended" which allows you to pick specific records from the list box. I also have a button to allow you to produce a report based on the values u've selected from the list box. the button is based on a sub and a function, here is the code for both:
Function :
Private Function GetCriteria() As String
Dim stDocCriteria As String
Dim VarItm As Variant
For Each VarItm In lstContList.Ite msSelected
stDocCriteria = stDocCriteria & "[LifeID] = " & lstContList.Col umn(0, VarItm) & " OR "
Next
If stDocCriteria <> "" Then
stDocCriteria = Left(stDocCrite ria, Len(stDocCriter ia) - 4)
Else
stDocCriteria = "True"
End If
GetCriteria = stDocCriteria
End Function
Button to execute the function :
Private Sub cmdRpt_Click()
DoCmd.OpenRepor t "rptContLif e", acPreview, , GetCriteria()
End Sub
So the question is: Since I only have 1 query and 1 report in my system and I want to keep it this way, can i assign a title to the report by clicking the button? Either through a list of pre-typed titles or a manual input. The way I picture it is basicly you select the values you need from the list box, press the button, a input box comes up asking you to input the report title, you input "Values I want" and you get a report generated with the title "Values I want"
Is this possible?
Looking forward to your answer,
Yours truly novice access user.
p.s. im in access 2007
i have a search system which gives you the values you search for in a list box. The list box has its "Multi Select" property set to "Extended" which allows you to pick specific records from the list box. I also have a button to allow you to produce a report based on the values u've selected from the list box. the button is based on a sub and a function, here is the code for both:
Function :
Private Function GetCriteria() As String
Dim stDocCriteria As String
Dim VarItm As Variant
For Each VarItm In lstContList.Ite msSelected
stDocCriteria = stDocCriteria & "[LifeID] = " & lstContList.Col umn(0, VarItm) & " OR "
Next
If stDocCriteria <> "" Then
stDocCriteria = Left(stDocCrite ria, Len(stDocCriter ia) - 4)
Else
stDocCriteria = "True"
End If
GetCriteria = stDocCriteria
End Function
Button to execute the function :
Private Sub cmdRpt_Click()
DoCmd.OpenRepor t "rptContLif e", acPreview, , GetCriteria()
End Sub
So the question is: Since I only have 1 query and 1 report in my system and I want to keep it this way, can i assign a title to the report by clicking the button? Either through a list of pre-typed titles or a manual input. The way I picture it is basicly you select the values you need from the list box, press the button, a input box comes up asking you to input the report title, you input "Values I want" and you get a report generated with the title "Values I want"
Is this possible?
Looking forward to your answer,
Yours truly novice access user.
p.s. im in access 2007
Comment