help with coding - for creating secure login forms

Hi All,

I have been doing some search on this topic and require some coding help.

I want to create a login form which checks for username, pwd and 
securitylevel and accordingly give access to certain queries , forms and 
reports. I do not want to use the Access user level security wizard and want 
to create a separate security module.

I have come across this code posted by Klatuu which is probably the solution 
i am looking for.

Public Function SetSecurityProp(UserInitials As String, SecurityLevel As 
Integer) As Boolean
Dim prp As Property
    Const conPropNotFound As Integer = 3270

    On Error GoTo ErrorSetSecurityProp
    ' Explicitly refer to Properties collection.
    CurrentDb.Properties("User") = UserInitials
    CurrentDb.Properties.Refresh
    CurrentDb.Properties("SecurityLevel") = SecurityLevel
    CurrentDb.Properties.Refresh
    SetSecurityProp = True
    
ExitSetSecurityProp:
    Exit Function
    
ErrorSetSecurityProp:
    If Err = conPropNotFound Then

' Create property, denote type, and set initial value.
        Set prp = CurrentDb.CreateProperty("User", dbText, UserInitials)
        ' Append Property object to Properties collection.
        CurrentDb.Properties.Append prp
        CurrentDb.Properties.Refresh
        Set prp = CurrentDb.CreateProperty("SecurityLevel", dbInteger, 
SecurityLevel)
        ' Append Property object to Properties collection.
        CurrentDb.Properties.Append prp
        CurrentDb.Properties.Refresh
        SetSecurityProp = True
        Resume ExitSetSecurityProp
    Else
        MsgBox Err & ": " & vbCrLf & Err.DESCRIPTION
        SetSecurityProp = False
        Resume ExitSetSecurityProp
    End If

End Function

Function ChangeProperty(strPropName As String, varPropType As Variant, 
varPropValue As Variant) As Integer
    Dim dbs As Object, prp As Variant
    Const conPropNotFoundError = 3270

    Set dbs = CurrentDb
    On Error GoTo Change_Err
    dbs.Properties(strPropName) = varPropValue
    ChangeProperty = True

Change_Bye:
    Exit Function

Change_Err:
    If Err = conPropNotFoundError Then    ' Property not found.
        Set prp = dbs.CreateProperty(strPropName, _
            varPropType, varPropValue)
        dbs.Properties.Append prp
        Resume Next
    Else
        ' Unknown error.
        ChangeProperty = False
        Resume Change_Bye
    End If
End Function


I want to know how to implement this. What is the table i should create and 
should i use this code as a module and how and were to call it.

How to implement case SecurityLevel =1
open form A
query A

case SecurityLevel =2
open form b

etc...

Would really appreciate if someone can help me out with this. I am not too 
much of a progammer but i am willing to learn.
0
Utf
11/22/2007 7:04:00 PM
access.formscoding 7493 articles. 0 followers. Follow

1 Replies
888 Views

Similar Articles

[PageSpeed] 9

On Thu, 22 Nov 2007 11:04:00 -0800, vandy <vandy@discussions.microsoft.com>
wrote:

>Would really appreciate if someone can help me out with this. I am not too 
>much of a progammer but i am willing to learn.

Well...

You're taking on a task that some very advanced programmers have found to be
very challenging indeed.

Security systems are DIFFICULT. It's hard to make such a system which is a)
effective at keeping the guys in black hats out while still b) not making life
miserable for the guys in white hats. Essentially any "home grown" security
system will be vulnerable to attack; Access workgroup security can be hacked
with a bit of effort and perhaps a google search; even SQL/Server security can
be broken, though with much more difficulty.

The analogy I'd use is to door locks on your house. If you need real security,
you can put in double-key locks, heavy duty bolt plates, etc. etc. - and the
burglar can still throw a rock through the picture window. If you want to
reliably keep anyone out, you need a concrete bunker... and then it's not a
house any more. "Locks keep honest people out"!

If you're trying to just direct honest employees to the right section of the
application, homegrown security can be useful. If you're trying to block a
skilled and intelligent user from intentionally breaking through your system
and accessing data they shouldn't....good luck; you'll need it.

             John W. Vinson [MVP]
0
John
11/23/2007 6:29:15 PM
Reply:

Similar Artilces:

help with log file
Got a database in SQL2005 that is basically a download of a daily flat text files and creating tables from them. The log.ldf file is frikkin huge. It's over 146GB and I don't need this, I have storage issues. How do I shorten down this file and keep it small forever? Hi Rocketman Have you read about managing the transaction log in the Books Online? How big is your database? What recovery model are you in? What kinds of backups are you doing, and how frequently? If you are not in SIMPLE recovery, and you don't back up your log, it will continue to grow. Even...

Reporting help!
I need to do the following - I want to generate a list of customers who purchased a particular product, and on that list also see what else they purchased. I would like to see the total sales for these transactions, and work out if people are buying my link sales.. any help would be great! ...

Need help in accessing a sharepoint site that I created with the AllTemplates.exe
SBS2008 with WSS 3.0 I downloaded the AllTemplates.exe from Microsoft and installed the Helpdesk template. I can acess the Helpdesk site from SBS2008 and add things to it but I can't access it from a workstation. Can anyone help me out? Thanks You mean you can only access the site from the Server in local , right? maybe we need more information such as error message. how about doing "ping" or "tracert" result. can you access a normal web site (not sharepoint site) from the workstation ? do you get an authentication window ? "john doe" wr...

using if function..please help
i am trying to use the if function in the following manner. A B apple red apple red grapes purple grapes yellow star n/a if(B1:B5="n/a",0,countif(A1:A5, "star") I want to use this formula not only for 'star' but also for 'apple' and grapes' and many more such fruits which might have n/a later. But, everytime I use this formula it returns a 1..should it not return a 0 for when the value in B is n/a? Please help.. Thank you Are you trying to say that if any c...

Disabling F1 key's Windows Help Function
We'll I guess the title says it all :) Just curious if there is an easy way to disable F1 from always trying to bring up Window's help whenever it is hit within the program. I find it more than a little annoying because even in my program where (I thought) I was capturing all keystrokes for a keyDown event (I added UINT MyClass:OnGetDlgCode() { return DLGC_WANTARROWS|DLGC_WANTALLKEYS|DLGC_WANTCHARS; } Hmmm, so can I add something else to this line perhaps (going to check on this now) in order to catch ALL keystrokes (or at least add something so windows help function will be di...

Creating a Campaign Response via Follow-up
When you create a new Task/Phone Call or other activity via the Follow-up tab, the new Activity is associated with the entity you are looking at. (so following up a Contact with a Phone Call will create a Phone Call which is associated with the Contact) This is not the case for the Campaign Response activity - when you create a Campaign Response via the Follow-up tab, the Customer field (ie regarding) is left blank and hence not associated with anyone. Presumably this is a bug - anyone know if there is a hotfix for this? Kind Regards, Paul. ...

Excel Form "Component Not Registered"
I am using several excel spreadsheet that are working on many other machines but they all of a sudden started giving me a "component not registered" error. I don't know of any changes to my workstation environment. In order to debug, I stripped down the excel spreadsheet to the bare minimum. I noticed that when all the forms were removed from the spreadsheet that the problem disapeared. I removed everything in the spreadsheet except for one form and a Workbook_Open() procedure. No problem occurs if I have an empty procedure but as soon as I even put a comment in th...

Users and Asset Data linked on Form
Hello everyone, I have two tables, one a Staff list and the other an Asset list extracted from seperate databases, the information in the tables has absolutely no common data, I have a form with the user name and other bits and pieces on from the staff list and also a drop down list of all asset numbers which I can then select the appropiate asset number from then, that asset number and other details I would like to be associated to that user. I have tried, I have done this in the past about 4 years ago but I cannot remember any of it! Any help would most appreciated Cheers David David, T...

How to convert a Chinese registry value from within a US code page?
First of all, our Win32 MFC VC++ app is not written in Unicode as it should have been. Given that - it reads uninstall information from the windows Uninstall registry tree and writes it to a report. It writes out the displayname of the application. Normally this is not a problem, but when it encounters a Chinese application name, it displays the name as question marks. I assume this is because the string is in Unicode in the registry, but our app is not Unicode so it can't represent the characters. Unfortunately for the moment, converting this very large app to Unicode is not an o...

Creating a summary sheet
I have a spreadsheet that is about 200 rows down and 60 columns accross. I want to create a second summary tab that will pull over only certain columns from the "detail" sheet. As I update the detail sheet I want to also update the summary sheet - so far no problem, but if I add a new row in the detai sheet - how can I also add the same row in the summary sheet and only bring over columns I want on the summary sheet (the columns are not next to each other) Paste link does not insert the row in the summary sheet unless I drag the formulas - which I do not want to do. Is th...

Apply this security update
--qzhgrregdv Content-Type: multipart/related; boundary="fimwsrpzzjzrq"; type="multipart/alternative" --fimwsrpzzjzrq Content-Type: multipart/alternative; boundary="nihpkigvdw" --nihpkigvdw Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Microsoft Customer this is the latest version of security update, the "November 2003, Cumulative Patch" update which eliminates all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express as well as three newly discovered vulnerabilities. Install now to ma...

Skip Records in a Form
I have a form in my database based on a table. The table is appended with new reocrds everyday. My goal is to have the form present only the new records and allow a user to key data into the new record and be recorded in the same table. The issue I have is that the form is displaying all records not just the new. Does anyone know a way to open a form and display only those records that have not been updated by the user? Thanks in advance Add a column for UpdateDate and update this column whenever a record is updated via the form. Set up a query to read all the rows/columns ...

Select Case help needed
I'm using a Select Case statement to check the value of 24 checkboxes on a form. If true for each case, run the related query. It seems to be running the first query it comes to and not continuing to check the rest. Below is sample code for the first 4 checkboxes. Can anyone help? Select Case True Case Me.chkQCT01.value = True DoCmd.OpenQuery "AccessMWapp", acNormal, acEdit Case Me.chkQCT02.value = True DoCmd.OpenQuery "AccessSEapp", acNormal, acEdit Case Me.chkQCT03.value = True DoCmd.OpenQuery "AccessSWapp", acNormal...

Quick Campaign "In Progress" HELP
I have a Quick Campaign that shows as "In Progress" for over a week now so it must be hung. How do I restart or get it going again? It sends out approx. 3000 emails each time. It got approx 2000 emails out and is now hung. I hace rebooted the CRM server itself but this had no impact. I'm afraid that if I do another Quick Campaign before resolving this it will just hang also. This has been working great for months until now. HELP! -- Dennis ...

2003 code raises error in 2007
I have a reference in VBA to a subform of a subform, which works fine in Access 2003. In Access 2007, however, it results in "you have entered an invalid reference to the property Form/Report." This is the snippet of code: Private Sub SetFormProperties() 'called from form_open, makes all forms editable if edit mode was selected Dim ctrl As Control, ctrlSub As Control Dim frm As Form If Me.OpenArgs = "Edit" Then Set frm = Me 'set main form edit options EditProperties frm 'set subform edit options For Each ctrl In frm If ct...

Help with VBasic in Excel 2003
I'm using Excel 2003. I am working in a master worksheet named "SHPG RCVG RPT" which is on my desktop. After I enter all of the information and create my hyperlinks, I need to protect the worksheet and then save it to a different folder. The new name of the worksheet is determined by the purchase order # which is in cell D3. I need a macro which will: Protect the worksheet --> Name the worksheet using the purchase order # in D3 -->Save the worksheet in: F:\SHIPPING RECEIVING REPORT. I can't do this using the macro recorder because it won't let me click on the ...

Excel sheet (OLE object) sometimes open on the form sometimes in E
Hello there, I have an Excel sheet (OLE object in the table) on a form , I have setup the Property in "Auto Activate" as Double-Click , so when I double click the object the sheet open. But sometime the object appears on the form as an Excel Icon - then when I double click it open in Excel - that is what I want. But sometime it appears as a table of data and when I double click it open on the form - I want to avoid that and instead always have the sheet open in excel. Any idea? Many many thanks, Dan Hi Dan, By default, you can directly double click the OLE Ob...

Should be able to create recurring service activities
It would be nice to be able to create recurring service activities and appointments. We use the shared service calendar and other members of my team cannot see when i am carrying out the month end routine each month unless i manually create an appointment for it. It would be most helpful if you could create a recurring appointment or service activity within crm to save time each time you have the same activity. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree&q...

Labels not printing zip codes
I am doing a simple mail merge from other peoples excel lists...when I print the lables, many of the zip codes show as a zero on the label. I notice a green comment error corner and by ignoring the error, the problem goes away but what causes this to begin with? If I highlight the whole column to format as zip codes the boxes do not go away. If I correct and then copy the data to a new sheet the new formatting does not save. Debra Dalgleish posted this to a similar question: There's an article on the Microsoft web site that might help you: Answer Box: Numbers don't merge rig...

Need help with Access report
I designed an access report with a facility and a buch of contacts for that. I created a group on the facility ID. I want only a certain type of contact to show up in the facility group header and rest of the contact types in the details sectio. Before some takes a wag at answering this, could you provide a little better description? Individual contacts normally would display in the detail section, not "in the facility group header". Maybe you should type in some significant records/fields and how and why they should display in your report. -- Duane Hookom Microsoft Access M...

Forms Help
I have a form, the form has an ID that goes through many test/parameters. All the test/parameters associated with the ID remains on a sub form for viewing. I would like to develop a series (a-z) for each ID,were repeating information for the id is carried throughout all ID's and the one test paramter that differed, thus changing the Series Letter will be changed. Do you have any suggestions. Thanks LA -- Message posted via http://www.accessmonster.com On Wed, 22 Aug 2007 14:04:05 GMT, "misschanda via AccessMonster.com" <u36612@uwe> wrote: >I have a form, the for...

Security Transmission in GP
Hi, I would like to know if the information transmitted in the network when a GP 9.0 Client connect to a GP Server, is encrypted? My password travel clear over the network? The transactions? If the answer is not, How can I encrypt it without disturbing GP or the network? Ariel, To enable encrypted connections for an instance of SQL Server 2000, you should set the Force Protocol Encryption option to Yes. Setting this option to Yes encrypts both the credentials transmitted during the logon process and all data transmitted across a network between SQL Server and the client. You can ...

Adding Array Fields on forms
How to use Modifier to add an array fields of 3 elements on a form? thks in advance. Hi HFLO, Open modifier and select gp or 3rd party and then select exisiting modified form or select new form and then open window layout. From the Toolbox slect local fields in drop-down and press the new button and then enter field name and enter the array size for e.g. 3 and then select the datatype string or text and press OK button. Toolbox will show the newly created the array field, select that arrayfield and drag and dropped onto the layout 3 times. Hence ur array field would be there on ur for...

vlookup problem please help
Hi experts, I have a problem in using vlookup function and have not been able to resolve for a year+. Hope I can find some help in this great forum. Many thanks in advance! An example as below. When I vlookup Material2 to Material1 for the Project No, I get the result 222-56 for all the duplicate Material1 values. In this case of having duplicate values in Material1 but associated with different Project Numbers, how can I have vlookup function to match the Project No. containg "AA" as 1st priority ? (and if there is no Project No. containing "AA", then vlookup to look f...

Help Please #8
Thanks For The Info : -- mikeee ----------------------------------------------------------------------- mikeeee's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1461 View this thread: http://www.excelforum.com/showthread.php?threadid=26424 ...