johnbird1988
Board Regular
- Joined
- Oct 6, 2009
- Messages
- 199
Hello
I would like to copy information from one form to another. I have been looking on the net for a while and cant get any thing to work.
I have a log In form called (LogInfrm) with Team Name (cboteamname) and Employee Name (cboEmployee) also with a password box and a button.
I then have another from which I would like the Team Name and Employee Name copied into. This form is called (Tesk Details) and the Team Name box (Text96) and a Employee Box (Text97).
I would like to information to copy when they have type the correct password in. I have copied the code for this below.
Thank you for your help
John
I would like to copy information from one form to another. I have been looking on the net for a while and cant get any thing to work.
I have a log In form called (LogInfrm) with Team Name (cboteamname) and Employee Name (cboEmployee) also with a password box and a button.
I then have another from which I would like the Team Name and Employee Name copied into. This form is called (Tesk Details) and the Team Name box (Text96) and a Employee Box (Text97).
I would like to information to copy when they have type the correct password in. I have copied the code for this below.
Thank you for your help
John
Code:
Private Sub Command4_Click()
'Check to see if data is entered into the UserName combo box
If IsNull(Me.cboEmployee) Or Me.cboEmployee = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.cboEmployee.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtPassword.SetFocus
Exit Sub
End If
'Check value of password in tblEmployees to see if this matches value chosen in combo box
If Me.txtPassword.Value = DLookup("Password", "Contacts", "[ID]=" & Me.cboEmployee.Value) Then
lngMyEmpID = Me.cboEmployee.Value
'Close logon form and open splash screen
DoCmd.Close acForm, "LogInfrm", acSaveNo
DoCmd.OpenForm "Task Details"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.txtPassword.SetFocus
End If
'If User Enters incorrect password 3 times database will shutdown
intLogonAttempts = intLogonAttempts + 1
If intLogonAttempts > 3 Then
MsgBox "You do not have access to this database. Please contact your system administrator.", vbCritical, "Restricted Access!"
Application.Quit
End If
End Sub