randolphoralph
Registered User.
- Local time
- Today, 10:14
- Joined
- Aug 4, 2008
- Messages
- 101
Editing SwitchboardID and ItemNumber
I am trying to implement the following in order to password protect an area on my Switchboard.
Here is a link to what I am trying to do...
www.daniweb.com/code/snippet216570.html
The problem is that when I follow the instructions on lines 85-141 I can not seem to get the code to work. I am having problems editing the code for the SwitchboardID and ItemNumber.
The button I want to set the password for is showing as SwitchboardID = 1 and ItemNumber = 1 (in the switchboard table)
I have edited the code at the link above and here is what I have....
I can not seem to get this to work....no matter what I do.
When I click on the button on the switchboard it just opens the Form and does not prompt for a password with the frmPassword form.
Any thoughts would be greatly appreciated.
I am trying to implement the following in order to password protect an area on my Switchboard.
Here is a link to what I am trying to do...
www.daniweb.com/code/snippet216570.html
The problem is that when I follow the instructions on lines 85-141 I can not seem to get the code to work. I am having problems editing the code for the SwitchboardID and ItemNumber.
The button I want to set the password for is showing as SwitchboardID = 1 and ItemNumber = 1 (in the switchboard table)
I have edited the code at the link above and here is what I have....
Code:
'Below is the modified code I put into the Switch board
Dim Hold As Variant
Dim tmpKey As Long
Dim I As Integer
Dim rs1 As DAO.Recordset
Dim db As DAO.Database
Me.Filter = "[ItemNumber] = 0 AND [SwitchboardID]=" & rs![Argument]
'Below is where you set the button
[B]If Val([ItemNumber]) = 1 And Val([SwitchboardID]) = 1[/B] Then
DoCmd.OpenForm "frmPassword", acNormal, , , , acDialog
Hold = MyPassword
Set db = CurrentDb
Set rs1 = db.OpenRecordset("tblPassword", dbOpenTable)
If rs1.NoMatch Then
MsgBox "Sorry cannot find password information. Try Again"
Cancel = -1
' Move to the switchboard page that is marked as the default.
Me.Filter = "[ItemNumber] = 0 AND [Argument] = 'Default' "
Me.FilterOn = True
ElseIf Not (rs1![KeyCode] = KeyCode(CStr(Hold))) Then
MsgBox "Sorry password does not match Key Code." & _
"Try again.", vbOKOnly, "Incorrect Password"
Cancel = -1
' Move to the switchboard page that is marked as the default.
Me.Filter = "[ItemNumber] = 0 AND [Argument] = 'Default' "
Me.FilterOn = True
End If
rs1.Close
db.Close
End If
I can not seem to get this to work....no matter what I do.
When I click on the button on the switchboard it just opens the Form and does not prompt for a password with the frmPassword form.
Any thoughts would be greatly appreciated.
Last edited: