Deployment/Security

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using a form to enter data in a table. I am currently sharing the
database over a network. Right now only two of us are using the database but
we want to add more. My first question is how do I get the new data that I
or others enter to show up for other users if we are all in the database at
the same time? Example, both me and my co-worker are in the database and I
add a record and the move to a different record. When my coworker tries to
find the record I just added it doesn't show up. I have tried to add the
macro Requery to the form AfterUpdate but that doesn't work. Any
suggestions? Second, I have read something about front and back end is this
a better way to share than to just add a shortcut to each users desktop?
Third, in regards to security I would like to make it so each user has to
logon to get into the program. As it is now I had to add users to each
workstation. Is there a way to add all users in one place and assign
passwords for each? This is important because each record added is tagged
with the current user. Finally, I would like to be able to seach by specific
controls (fields) in the form (ex. Policy #). How am I able to seach just
based on policy # and have the record returned within the form?
 
I can tell you something about third part of question. You can add all user
in a table which you should add to your database. i.e.
TABLE Users
UserName pk [text]
UserPassword [text]
After that, you have to make a form, similar to windows log-on form with
only two text boxes and two buttons.
TextBox1:User name
TextBox2:Password
Button1: Ok
Button2: Cancel

User have to enter UserName and Password and after that to click Ok button.
When they do that, you have to add the following code, on OnClick event for
Ok button:

Dim dbs As Database
Dim rst As Recordset
Dim sql As String
Dim response As String

DoCmd.Hourglass True

Set dbs = CurrentDb

sql = "SELECT * FROM Users WHERE UserName = '" & Me.TextBox1 & "'"

Set rst = dbs.OpenRecordset(sql)
If (rst.RecordCount = 1) Then
rst.MoveFirst
' Password correct
If (rst![UserPassword] = Me.TextBox2) Then
DoCmd.Hourglass False
DoCmd.Close
DoCmd.OpenForm "SomeOtherForm" ' here you have to change
the name of your main form
' Password incorrect
Else
DoCmd.Hourglass False
response = MsgBox("Password doesn't match user name",
vbInformation, "Wrong password")
Me.TextBox2 = Null
Me.TextBox2.SetFocus
End If
' User name doesn't exist
Else
DoCmd.Hourglass False
response = MsgBox("User name doesn't exist.", vbInformation,
"Wrong user name")
End If
rst.Close
dbs.Close

About front-end and back-end architecture you can read something about that
in Access help. It should help you to decide do you need it or not.
Vojislav Depalov
 
Back
Top