Open form in another database by login (1 Viewer)

anissw

Registered User.
Local time
Today, 03:10
Joined
Jun 11, 2012
Messages
55
Hi- I wanted to know if it's possible to open a form in another database based on login? I am setting up multi-user front end forms on a server into each user folder. The main form contains 2 drop down lists to select report and site name. Once the click submit, login screen appears. After logging in, the report screen opens for data entry. However, since 10 users will be entering data (sometimes simultaneously), I will need separate front end forms and the script should open the form that's in the user folder. Access 2010 is only accessible by remote login on our server, therefore, I am unable to set a copy of the front end form on each user's desktop computer. I have been researching through blogs of how to open a form in another database, but couldn't find based on login.

Any thoughts and questions would be great! :)
 

liddlem

Registered User.
Local time
Today, 08:10
Joined
May 16, 2003
Messages
339
hi Annisw
On my main form (which is a navigation form) I make a call to the getLogOnName function.
In my DB, I have table (called User_ACL) that has the fields UserID,FormName,CanEdit,CanSee

Here is a sample of my code.

On the main forms 'on load' event
MyUser = GetLogonName()
Me.LogonName = MyUser
Me.UserDisplayName = DLookup("DisplayName", "Qry_LoggedOnUser")
Me.UserEmail = DLookup("EmailAddress", "Qry_LoggedOnUser")
Me.Dept = DLookup("Department", "Qry_LoggedOnUser")
Me.Office = DLookup("Office", "Qry_LoggedOnUser")
Me.UserID = DLookup("ID", "Qry_LoggedOnUser")

MyUserId = Me.UserID
sql = "SELECT dbo_NPY_ACL_User.User_ID, dbo_NPY_ACL_User.NavBtn_ID, dbo_NPY_ACL_User.CanSee, dbo_NPY_ACL_User.CanEdit" & vbCr _
& "FROM dbo_NPY_ACL_User" & vbCr _
& "WHERE (((dbo_NPY_ACL_User.User_ID)=" & MyUserId & ") AND ((dbo_NPY_ACL_User.CanSee)=False)) OR (((dbo_NPY_ACL_User.User_ID)=" & MyUserId & ") AND ((dbo_NPY_ACL_User.CanEdit)=False));"
MyQry = "Qry_NPY_ACL_User"

Set rsDAO = CurrentDb.OpenRecordset(sql, dbOpenDynaset, dbSeeChanges)
'MyMsg = MsgBox("DAO Records = " & MyDAORCount, vbOKOnly, "Record Count")
'If rsDAO.RecordCount > 0 Then
Debug.Print "DAO Records"
While (Not rsDAO.EOF)
' Debug.Print rsDAO.Fields("User_ID"); rsDAO![NavBtn_ID]; rsDAO![CanSee]; rsDAO![CanEdit]
'Debug.Print rsDAO![NavBtn_ID]

MyBtn = rsDAO![NavBtn_ID]
If Not (rsDAO![CanSee]) Then
Select Case MyBtn
'Simply hides the navigation buttons from users if they dont have permission to that option
Case 14
If Not (rsDAO![CanSee]) Then
'[NavigationSubform].Form![FindItinerary].Visible = False
End If
Me.NavigationButton14.Width = 0 'TRAVEL
Case 17
Me.NavigationButton17.Height = 0 'TRAVEL - Itinerary
Case 22
Me.NavigationButton22.Width = 0 'VPM
end select

Perhaps you could modify this to suit your needs?
 

Users who are viewing this thread

Top Bottom