A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Security question



 
 
Thread Tools Display Modes
  #1  
Old May 19th, 2010, 02:45 PM posted to microsoft.public.access
Ixtreme
external usenet poster
 
Posts: 32
Default Security question

I have a simple database with many fields that have an 'On not in
list' command. The current code asks for a password to continue by
means of an Inputbox. This works fine. Unfortunately, the password
information can be seen by everybody (it is not masked). Is it
possible to open a new password form and pass the password information
somehow to this 'on not in list event'? If the password is correct,
the code should continue, if not an warning.

The current code looks like this:

pw = InputBox("Enter password to continue")
If pw = "1234" Then
Set db = CurrentDb
Set rs = db.OpenRecordset(strTblName, dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!TEST = NewData
rs.Update
  #2  
Old May 19th, 2010, 03:19 PM posted to microsoft.public.access
Tom van Stiphout[_2_]
external usenet poster
 
Posts: 1,653
Default Security question

On Wed, 19 May 2010 06:45:04 -0700 (PDT), Ixtreme
wrote:

Yes you can. Here are a few tips:
* Open that new form using WindowMode=acDialog, so it is modal just
like InputBox is.
* When user clicks OK or Cancel in the new form, run
"Me.Visible=False". This makes the form "fall out of the modal loop"
so the next line after DoCmd.Openform runs. In that line you can
inspect the password form to determine what password was entered, and
whether user clicked OK or Cancel. Finally you close that form
(DoCmd.Close "myPasswordForm")
* You're not handling Cancel yet in your code, but it's important.

-Tom.
Microsoft Access MVP


I have a simple database with many fields that have an 'On not in
list' command. The current code asks for a password to continue by
means of an Inputbox. This works fine. Unfortunately, the password
information can be seen by everybody (it is not masked). Is it
possible to open a new password form and pass the password information
somehow to this 'on not in list event'? If the password is correct,
the code should continue, if not an warning.

The current code looks like this:

pw = InputBox("Enter password to continue")
If pw = "1234" Then
Set db = CurrentDb
Set rs = db.OpenRecordset(strTblName, dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!TEST = NewData
rs.Update

  #3  
Old May 19th, 2010, 03:25 PM posted to microsoft.public.access
John Spencer
external usenet poster
 
Posts: 7,815
Default Security question

The way to do this is to open a custom form in dialog mode.
Set the Input mask for the control for entering the password to
Password
Then when the user presses the close button on the form, set the form's
visible property to NO (don't close it).


Docmd.OpenForm "frmGetPassword",,,,,acDialog
If Forms!frmGetPassword!PasswordTextBox = "1234" THEN
DoCmd.Close acForm, "frmGetPassword" 'Close the password form
Set db = CurrentDb
Set rs = db.OpenRecordset(strTblName, dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!TEST = NewData
rs.Update
ELSE
DoCmd.Close acForm, "frmGetPassword" 'Close the password form
End if


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

Ixtreme wrote:
I have a simple database with many fields that have an 'On not in
list' command. The current code asks for a password to continue by
means of an Inputbox. This works fine. Unfortunately, the password
information can be seen by everybody (it is not masked). Is it
possible to open a new password form and pass the password information
somehow to this 'on not in list event'? If the password is correct,
the code should continue, if not an warning.

The current code looks like this:

pw = InputBox("Enter password to continue")
If pw = "1234" Then
Set db = CurrentDb
Set rs = db.OpenRecordset(strTblName, dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!TEST = NewData
rs.Update

  #4  
Old May 19th, 2010, 03:56 PM posted to microsoft.public.access
Ixtreme
external usenet poster
 
Posts: 32
Default Security question

On 19 mei, 16:25, John Spencer wrote:
The way to do this is to open a custom form in dialog mode.
Set the Input mask for the control for entering the password to
* * Password
Then when the user presses the close button on the form, set the form's
visible property to NO (don't close it).

Docmd.OpenForm "frmGetPassword",,,,,acDialog
If Forms!frmGetPassword!PasswordTextBox = "1234" THEN
* * DoCmd.Close acForm, "frmGetPassword" 'Close the password form
* * Set db = CurrentDb
* * Set rs = db.OpenRecordset(strTblName, dbOpenDynaset)
* * On Error Resume Next
* * * *rs.AddNew
* * * *rs!TEST = NewData
* * * *rs.Update
ELSE
* * DoCmd.Close acForm, "frmGetPassword" 'Close the password form
End if

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County



Ixtreme wrote:
I have a simple database with many fields that have an 'On not in
list' command. The current code asks for a password to continue by
means of an Inputbox. This works fine. Unfortunately, the password
information can be seen by everybody (it is not masked). Is it
possible to open a new password form and pass the password information
somehow to this 'on not in list event'? If the password is correct,
the code should continue, if not an warning.


The current code looks like this:


pw = InputBox("Enter password to continue")
If pw = "1234" Then
* * * * Set db = CurrentDb
* * * * Set rs = db.OpenRecordset(strTblName, dbOpenDynaset)
* * * * On Error Resume Next
* * * * * * rs.AddNew
* * * * * * rs!TEST = NewData
* * * * * * rs.Update- Tekst uit oorspronkelijk bericht niet weergeven -


- Tekst uit oorspronkelijk bericht weergeven -


I tried this but get an error 2450: MS Access cant find the form
'frmGetPassword' referred to in a Macro or Expression etc.
I created the form and it shows on the right time. After I click the
close button this warning is being displayed. Why?
  #5  
Old May 19th, 2010, 09:20 PM posted to microsoft.public.access
John Spencer
external usenet poster
 
Posts: 7,815
Default Security question

Because you closed the form frmGetPassword. Don't close it. Use a button on
the form to set the form's visible property to false to hide the form.

Me.Visible = False

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

Ixtreme wrote:
On 19 mei, 16:25, John Spencer wrote:
The way to do this is to open a custom form in dialog mode.
Set the Input mask for the control for entering the password to
Password
Then when the user presses the close button on the form, set the form's
visible property to NO (don't close it).

Docmd.OpenForm "frmGetPassword",,,,,acDialog
If Forms!frmGetPassword!PasswordTextBox = "1234" THEN
DoCmd.Close acForm, "frmGetPassword" 'Close the password form
Set db = CurrentDb
Set rs = db.OpenRecordset(strTblName, dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!TEST = NewData
rs.Update
ELSE
DoCmd.Close acForm, "frmGetPassword" 'Close the password form
End if

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County



Ixtreme wrote:
I have a simple database with many fields that have an 'On not in
list' command. The current code asks for a password to continue by
means of an Inputbox. This works fine. Unfortunately, the password
information can be seen by everybody (it is not masked). Is it
possible to open a new password form and pass the password information
somehow to this 'on not in list event'? If the password is correct,
the code should continue, if not an warning.
The current code looks like this:
pw = InputBox("Enter password to continue")
If pw = "1234" Then
Set db = CurrentDb
Set rs = db.OpenRecordset(strTblName, dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!TEST = NewData
rs.Update- Tekst uit oorspronkelijk bericht niet weergeven -

- Tekst uit oorspronkelijk bericht weergeven -


I tried this but get an error 2450: MS Access cant find the form
'frmGetPassword' referred to in a Macro or Expression etc.
I created the form and it shows on the right time. After I click the
close button this warning is being displayed. Why?

  #6  
Old May 20th, 2010, 08:55 AM posted to microsoft.public.access
Ixtreme
external usenet poster
 
Posts: 32
Default Security question

On 19 mei, 22:20, John Spencer wrote:
Because you closed the form frmGetPassword. *Don't close it. *Use a button on
the form to set the form's visible property to false to hide the form.

* *Me.Visible = False

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County



Ixtreme wrote:
On 19 mei, 16:25, John Spencer wrote:
The way to do this is to open a custom form in dialog mode.
Set the Input mask for the control for entering the password to
* * Password
Then when the user presses the close button on the form, set the form's
visible property to NO (don't close it).


Docmd.OpenForm "frmGetPassword",,,,,acDialog
If Forms!frmGetPassword!PasswordTextBox = "1234" THEN
* * DoCmd.Close acForm, "frmGetPassword" 'Close the password form
* * Set db = CurrentDb
* * Set rs = db.OpenRecordset(strTblName, dbOpenDynaset)
* * On Error Resume Next
* * * *rs.AddNew
* * * *rs!TEST = NewData
* * * *rs.Update
ELSE
* * DoCmd.Close acForm, "frmGetPassword" 'Close the password form
End if


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County


Ixtreme wrote:
I have a simple database with many fields that have an 'On not in
list' command. The current code asks for a password to continue by
means of an Inputbox. This works fine. Unfortunately, the password
information can be seen by everybody (it is not masked). Is it
possible to open a new password form and pass the password information
somehow to this 'on not in list event'? If the password is correct,
the code should continue, if not an warning.
The current code looks like this:
pw = InputBox("Enter password to continue")
If pw = "1234" Then
* * * * Set db = CurrentDb
* * * * Set rs = db.OpenRecordset(strTblName, dbOpenDynaset)
* * * * On Error Resume Next
* * * * * * rs.AddNew
* * * * * * rs!TEST = NewData
* * * * * * rs.Update- Tekst uit oorspronkelijk bericht niet weergeven -
- Tekst uit oorspronkelijk bericht weergeven -


I tried this but get an error 2450: MS Access cant find the form
'frmGetPassword' referred to in a Macro or Expression etc.
I created the form and it shows on the right time. After I click the
close button this warning is being displayed. Why?- Tekst uit oorspronkelijk bericht niet weergeven -


- Tekst uit oorspronkelijk bericht weergeven -


John,

Thank you so much!

Kind regards,

Mark
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:49 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.