Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Password System

Status
Not open for further replies.

antfrompont

IS-IT--Management
Nov 25, 2008
2
GB
I am trying to set up a simple password system whereby two different users can access 2 difernt forms, say Form1 and Form2.They then may need to go to a common form, say Form3.
The problem is that if user1 goes to form1 and then form3, i need user1 to return to form1 wheras if user2 goes to form2 and then form3 then user2 returns to form2.
Basically I need users to return to the form they came from originally.
This will clearly need a global variable for username ( entered on a login form) but i can't seem to be able to test for this on the other forms.
Many Thanks for any help.
 
What have you tried so far and where in your code are you stuck ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
i have a logon form called frmlogon and text boxes called
txtuserid and txtpassword (which i'm gnoring in the trial)and an OK button ( cmdok)
I have 3 other forms, frmmenu1, frmmenu2 and frmmenu3

I have set up

option explicit
public staffid as string

{ this i want to pick up the value of txtuserid so thet on loading menu3 the button on menu3 can be coded to go back to menu1(if fred) else menu2 ( if john)

The following works ok except for the assignment line
staffid=txtuserid.text, which gives an error "you cant refereence a property unless the control has focus"

The cmdok button has the follwing code (just to test)

Private Sub cmdlogon_Click()
Dim staffid As String

On Error GoTo Err_cmdlogon_Click

Dim stDocName As String
Dim stLinkCriteria As String
If txtuserid = "fred" Then
stDocName = "frmmenu1"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
If txtuserid = "john" Then
stDocName = "frmmenu2"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
End If
staffid = txtuserid.Text

Exit_cmdlogon_Click:
Exit Sub

Err_cmdlogon_Click:
MsgBox Err.Description
Resume Exit_cmdlogon_Click

End Sub


** This is as far as I'm getting

Many thanks for any ideas

Antfrompont
 
you cant refereence a property unless the control has focus
staffid=txtuserid.Value

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top