Hi,
I'm trying to print out a report automatically after a sequence has run and the code below works fine except the report really needs to print out in landscape and not portrait, the code below opens the query in preview mode, prints it and then closes preview mode and the display then reverts to the original form the code is on. I tried the PrtDev function but that doesn't seem to work for queries, any ideas? If your wondering why i don't just make a report of the query it's because it's a crosstab and the fields are constantly changing so a report is out of the question
Dim stDocName As String
stDocName = "Query1"
DoCmd.OpenQuery stDocName, acViewPreview, acEdit
DoCmd.PrintOut
DoCmd.Close
I'm trying to print out a report automatically after a sequence has run and the code below works fine except the report really needs to print out in landscape and not portrait, the code below opens the query in preview mode, prints it and then closes preview mode and the display then reverts to the original form the code is on. I tried the PrtDev function but that doesn't seem to work for queries, any ideas? If your wondering why i don't just make a report of the query it's because it's a crosstab and the fields are constantly changing so a report is out of the question
Dim stDocName As String
stDocName = "Query1"
DoCmd.OpenQuery stDocName, acViewPreview, acEdit
DoCmd.PrintOut
DoCmd.Close