473,398 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Password Protected ListBox Selection/Command Button

tbl_Report
- DBReportName
- MenuReportName
- FacilityID
- ReportType
- Viewable (Yes/No)
- PasswordProtected (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_Click

Dim strReport As String
Dim strPW As String
Dim strGetPWReq As String

strReport = Me.listReport.Column(0)

If Len(Me.txtdatefrom & vbNullString) = 0 Or Len(Me.txtDateTo & vbNullString) = 0 Then
MsgBox "Please Select A Date Range!", _
vbInformation, "Required Data..."
Exit Sub
Else
If Me.listReport.Column(5) = -1 Then
strGetPWReq = InputBox("Enter Password")
strPW = Me.listReport.Column(6)
If strPW = strGetPWReq Then
DoCmd.OpenReport strReport, acViewReport
Else
MsgBox "Incorrect Password"
Exit Sub

End If
End If
End If

Exit_cmdReport_Click:
Exit Sub

Err_cmdReport_Click:
MsgBox Err.Description
Resume Exit_cmdReport_Click

End Sub


Dead Button...nothing happens when I click it. Any noticeable flaws in the code?
Jan 9 '08 #1
1 1869
I have made a few changes, but still no luck...

Private Sub cmdReport_Click()
On Error GoTo Err_cmdReport_Click

Dim strReport As String
Dim strPW As String
Dim strGetPWReq As String

strReport = Me.listReport.Column(0)
strPW = Me.listReport.Column(6)


If Len(Me.txtdatefrom & vbNullString) = 0 Or Len(Me.txtDateTo & vbNullString) = 0 Then
MsgBox "Please Select A Date Range!", _
vbInformation, "Required Data..."
Exit Sub
Else

If Me.listReports.Column(5) = -1 Then

strGetPWReq = InputBox("Enter Password")
If strGetPWReq = strPW Then
DoCmd.OpenReport strReport, acViewReport
DoCmd.Maximize
Else
MsgBox "Incorrect Password"
Exit Sub
End If
Else
DoCmd.OpenReport strReport, acViewReport
DoCmd.Maximize
End If
End If

Exit_cmdReport_Click:
Exit Sub

Err_cmdReport_Click:
MsgBox Err.Description
Resume Exit_cmdReport_Click
End Sub
Jan 9 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Fieldmedic | last post by:
I'm attempting to get an arraylist to display in a Listbox (listbox2). The arraylist is created from selections in a different listbox (listbox1). The 1st listbox has a selection mode of...
1
by: Annette Massie | last post by:
I would like to have a form that lists current addresses being used. On this form I would also like to have a command button that would allow the user to add an address if they do not see it...
2
by: jpalmerx | last post by:
Hi, I have a form in Access with a listbox containing some choices. There is a "Select" button underneath that runs a macro opening a form that acts on the selected value. What I can't figure...
6
by: Dan Bass | last post by:
If you look at explorer, right clicking on a file, first selects the file, then throws up the context menu relating to that selection. With a Windows ListBox control and a simple context menu,...
0
by: AK | last post by:
Hello, Listbox mulitselect property is set to true (extended). I am trying to implement drag and drop feature for a listbox. The drag & drop is done in the mouse move event (DoDragdrop...
10
by: ken | last post by:
Hi, Say I have a list box. I also created a control on a form bound to that list box. When I click different rows in the listbox the control changes the ID of the row depending on what I click. ...
4
by: Jeff | last post by:
....still new at this. ...hopefully a simple question Is there some practical way of altering the function of a keypress in Visual Web.net 2005 using VB without causing a postback on each...
3
by: Noel S Pamfree | last post by:
Problem 1 ======= I need to create a page for a friend who operates a school website. She needs to set up a page so that only the Governors can access it. I thought I'd try to use JavaScript to...
1
by: dkohel | last post by:
I have 2 list boxes on my form. I am trying to populate listbox B with the selection from listbox A. I have set multi-select in both boxes to Extended... The user will select the items from...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.