Ok Mate,
I almost understood what you want to do, but as I have seen that your sales can login without a user name and password I think, here is the key, to be able to work fine with the database you must have a users table, in the users table you can specify their level and from there they can see what they have to see,
now as they can login and see the records which is related to their number here you have passed a stage, but then to add the dispatchers here you have to identify them as dispatchers,
because your user table in the level section you can identify the user as sales or as dispatcher or as admin, and then from the entry form of the user you will write the code on the click button,
Private Sub cmdLogin_Click()
Dim msg, style, title
'this is to tell your control which level is your user _
If Me.UserLevel = "Dispatcher" Then
GoTo CL_Dispatcher
ElseIf Me.EPosition = "Sales" Then
GoTo CL_Sales
End If
'this Command Line to apply condition in case the user is a dispatcher _
CL_Dispatcher:
docmd.openform, "frm_Dispatcher
Goto ExitCmd
' and this Command Line to open the sales form _
CL_Sales:
docmd.openform, "frm_Sales"
Goto ExitCmd
'to stop the code every time you apply a condition _
ExitCmd
Exit sub
End Sub
on this command button you write the code and put all the conditions of the users entry and what they can see and which forms they can log in to, and on every form you can write a code on the OnLoad event to check the user level on the Login form and show or hide whatever controls you want.
this is a short Idea for how to setup the login to your database, and by the way from the users table in the user level field, if you manage to really know how to setup you can by then divert each user on your database to where ever you want you can even know who is using the database now and you can also kick them out, actually I have to pay a thank to ( The Doc Man ) a member in this Forum, who opened my eyes to how profitable it can be if I make the User form as a main entry form to the database because now I manage to block users, kick users, see the users who is online and who is offline and also I can know from which machine the user has used his password and user name on my network. there is a lot of things which we can cover on this which is not enough to be covered by one session, just check my reply and see if it is useful and then we can cover more,
Join my group and let's learn group name is ( The New To Access Group )
See ya.....
------------------------------------------------------------
think logic and you can do everything, Access has no limits,
------------------------------------------------------------