Hey All,
This is the code i have so far for printing a report in access. I want to print out the report with its data in it. When i print it seems to just come with a blank report + only the headings appear. How do i print the report with populated information?
Dim nGroup_ID As Integer
'Dim ObjAccess As Access.Application
Dim objAccess As Object
Dim strDBDir As String
Dim strSQL As String
Dim dtFromDate As String
Dim dtToDate As String
Screen.MousePointer = vbHourglass
strDBDir = m_Conn.Properties("Data Source"
'Set objAccess = New Access.Application
Set objAccess = CreateObject("Access.Application"
objAccess.OpenCurrentDatabase strDBDir, False
objAccess.DoCmd.OpenReport "rptVisitorsIn", acViewDesign
strSQL = "SELECT tblmain.ID,tblmain.VisitorName,tblmain.VisitorCompany,tblmain.Visiting,tblmain.CarReg,tblmain.Date,tblmain.time,tblmain.DateOut from tblmain"
objAccess.Reports(0).RecordSource = strSQL
objAccess.DoCmd.OpenReport "rptVisitorsIn", acViewNormal
objAccess.CloseCurrentDatabase
objAccess.Quit acQuitSaveNone
Screen.MousePointer = vbDefault
Thanks in advance,
Agent009
This is the code i have so far for printing a report in access. I want to print out the report with its data in it. When i print it seems to just come with a blank report + only the headings appear. How do i print the report with populated information?
Dim nGroup_ID As Integer
'Dim ObjAccess As Access.Application
Dim objAccess As Object
Dim strDBDir As String
Dim strSQL As String
Dim dtFromDate As String
Dim dtToDate As String
Screen.MousePointer = vbHourglass
strDBDir = m_Conn.Properties("Data Source"
'Set objAccess = New Access.Application
Set objAccess = CreateObject("Access.Application"
objAccess.OpenCurrentDatabase strDBDir, False
objAccess.DoCmd.OpenReport "rptVisitorsIn", acViewDesign
strSQL = "SELECT tblmain.ID,tblmain.VisitorName,tblmain.VisitorCompany,tblmain.Visiting,tblmain.CarReg,tblmain.Date,tblmain.time,tblmain.DateOut from tblmain"
objAccess.Reports(0).RecordSource = strSQL
objAccess.DoCmd.OpenReport "rptVisitorsIn", acViewNormal
objAccess.CloseCurrentDatabase
objAccess.Quit acQuitSaveNone
Screen.MousePointer = vbDefault
Thanks in advance,
Agent009