Hi,
I am new to Access DB , my role is more of network supporting. I have this in house access DB. I was assigned to edit some records in the DB. while I changed some records and now when I try to generate email it is giving me this error. when I click debug it opens the editor with cursor at the line - strReportName = Me![cboSelectReport1]
The DB is about systems outages and generate email reports for sending to manager. the code is as follows:
=================================
Option Compare Database
Option Explicit
Dim strRecordSource As String
Dim strRecordSource1 As String
Dim strFieldName As String
Dim strSQL As String
Dim strReportName As String
Dim strValueList As String
Private Sub cmdPrint_Click()
Dim strFilter As String
Dim rpt As Report
Dim strInfo As String
Dim strInput As String
'strInput = InputBox("Enter Your First and Last Name")
'Username = strInput
DoCmd.SetWarnings False
DoCmd.OpenQuery "del_emailing", acNormal, acEdit
DoCmd.OpenQuery "EmailApp", acNormal, acEdit
DoCmd.OpenQuery "EmailInf", acNormal, acEdit
DoCmd.OpenQuery "Emailext", acNormal, acEdit
strReportName = Me![cboSelectReport1]
strFieldName = Me![cboSelectField]
strFilter = "[" & strFieldName & "] " & strValueList
strInfo = "Filtered by " & strFilter
Debug.Print "Filter: " & strFilter
DoCmd.OpenReport strReportName, acViewPreview
Set rpt = Reports(strReportName)
rpt.OrderByOn = True
rpt.OrderBy = strFieldName
rpt.FilterOn = True
rpt.Filter = strFilter
cmdPrint_ClickExit:
Exit Sub
cmdPrint_ClickError:
MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description
Resume cmdPrint_ClickExit
End Sub
====================================
I will really appreciate help.
Thanks.
Hunter.
I am new to Access DB , my role is more of network supporting. I have this in house access DB. I was assigned to edit some records in the DB. while I changed some records and now when I try to generate email it is giving me this error. when I click debug it opens the editor with cursor at the line - strReportName = Me![cboSelectReport1]
The DB is about systems outages and generate email reports for sending to manager. the code is as follows:
=================================
Option Compare Database
Option Explicit
Dim strRecordSource As String
Dim strRecordSource1 As String
Dim strFieldName As String
Dim strSQL As String
Dim strReportName As String
Dim strValueList As String
Private Sub cmdPrint_Click()
Dim strFilter As String
Dim rpt As Report
Dim strInfo As String
Dim strInput As String
'strInput = InputBox("Enter Your First and Last Name")
'Username = strInput
DoCmd.SetWarnings False
DoCmd.OpenQuery "del_emailing", acNormal, acEdit
DoCmd.OpenQuery "EmailApp", acNormal, acEdit
DoCmd.OpenQuery "EmailInf", acNormal, acEdit
DoCmd.OpenQuery "Emailext", acNormal, acEdit
strReportName = Me![cboSelectReport1]
strFieldName = Me![cboSelectField]
strFilter = "[" & strFieldName & "] " & strValueList
strInfo = "Filtered by " & strFilter
Debug.Print "Filter: " & strFilter
DoCmd.OpenReport strReportName, acViewPreview
Set rpt = Reports(strReportName)
rpt.OrderByOn = True
rpt.OrderBy = strFieldName
rpt.FilterOn = True
rpt.Filter = strFilter
cmdPrint_ClickExit:
Exit Sub
cmdPrint_ClickError:
MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description
Resume cmdPrint_ClickExit
End Sub
====================================
I will really appreciate help.
Thanks.
Hunter.