DYNAMIC REPORT printing

Bosch

Registered User.
Local time
Yesterday, 16:21
Joined
May 13, 2005
Messages
89
I am trying to print reports based on a particular field value..I am not sure how I can do this...But tried the following code(if you can call it code)..I am really new to access and reports..

if the value is 1 then I want to print the report JOB which I created using the wizard..except that I want to supply a new SQL query based on the search results user have on their screen..

Thanks in advance..
----------------------------------------------------------------
Dim stDocName As Report


If Forms!Goggle_for_your_Team!Category.Value = 1 Then
'JOB
stDocName.Name = "JOB"
ElseIf Forms!Goggle_for_your_Team!Category.Value = 2 Then
'CONTACT
stDocName.Name = "CONTACTS"
ElseIf Forms!Goggle_for_your_Team!Category.Value = 3 Then
'PROGRAM
stDocName.Name = "PROGRAM"
ElseIf Forms!Goggle_for_your_Team!Category.Value = 4 Then
'DOCUMENTS
stDocName.Name = "DOCUMENTS"
ElseIf Forms!Goggle_for_your_Team!Category.Value = 5 Then
' GLOSSARY
stDocName.Name = "GLOSSARY"
End If

stDocName.RecordSource = "SearchSQL"
DoCmd.OpenReport stDocName, acViewNormal
 
Forgot to mention this. I am getting 'object variable block variable not set' error..
 

Users who are viewing this thread

Back
Top Bottom