tbl_Report
- DBReportName
- MenuReportName
- FacilityID
- ReportType
- Viewable (Yes/No)
- PasswordProtect ed (Yes/No)
- Password (Encrypted)
On MenuReport form...
1. User Selects Facility ID in a combobox
2. User Selects MenuReportName in list box (row source dependant on Facility ID selection)
3. User enters date range in txtDateFrom and txtDateTo
4. User clicks "View Report" button
Problem: I want the user to enter a password to view the report.
Private Sub cmdReport_Click ()
On Error GoTo Err_cmdReport_C lick
Dim strReport As String
Dim strPW As String
Dim strGetPWReq As String
strReport = Me.listReport.C olumn(0)
If Len(Me.txtdatef rom & vbNullString) = 0 Or Len(Me.txtDateT o & vbNullString) = 0 Then
MsgBox "Please Select A Date Range!", _
vbInformation, "Required Data..."
Exit Sub
Else
If Me.listReport.C olumn(5) = -1 Then
strGetPWReq = InputBox("Enter Password")
strPW = Me.listReport.C olumn(6)
If strPW = strGetPWReq Then
DoCmd.OpenRepor t strReport, acViewReport
Else
MsgBox "Incorrect Password"
Exit Sub
End If
End If
End If
Exit_cmdReport_ Click:
Exit Sub
Err_cmdReport_C lick:
MsgBox Err.Description
Resume Exit_cmdReport_ Click
End Sub
Dead Button...nothin g happens when I click it. Any noticeable flaws in the code?
- DBReportName
- MenuReportName
- FacilityID
- ReportType
- Viewable (Yes/No)
- PasswordProtect ed (Yes/No)
- Password (Encrypted)
On MenuReport form...
1. User Selects Facility ID in a combobox
2. User Selects MenuReportName in list box (row source dependant on Facility ID selection)
3. User enters date range in txtDateFrom and txtDateTo
4. User clicks "View Report" button
Problem: I want the user to enter a password to view the report.
Private Sub cmdReport_Click ()
On Error GoTo Err_cmdReport_C lick
Dim strReport As String
Dim strPW As String
Dim strGetPWReq As String
strReport = Me.listReport.C olumn(0)
If Len(Me.txtdatef rom & vbNullString) = 0 Or Len(Me.txtDateT o & vbNullString) = 0 Then
MsgBox "Please Select A Date Range!", _
vbInformation, "Required Data..."
Exit Sub
Else
If Me.listReport.C olumn(5) = -1 Then
strGetPWReq = InputBox("Enter Password")
strPW = Me.listReport.C olumn(6)
If strPW = strGetPWReq Then
DoCmd.OpenRepor t strReport, acViewReport
Else
MsgBox "Incorrect Password"
Exit Sub
End If
End If
End If
Exit_cmdReport_ Click:
Exit Sub
Err_cmdReport_C lick:
MsgBox Err.Description
Resume Exit_cmdReport_ Click
End Sub
Dead Button...nothin g happens when I click it. Any noticeable flaws in the code?
Comment