Hi Guys
I have created a button called 'Bank Details' when clicked it opens a small form asking you to enter a 'password'
Once this operation has been done and clicked the enter button I want FrmBankDetails to open to a specific record that relates to a record from FrmAdmin.
The textbox in FrmAdmin is called 'StudentName' and the cbobox in FrmBankDetails is called cboStudentName.
This just doesn't work and have tried various ways. I know it can be done using Macros because I've done it, I need it in VBA so that the 'password' works.
PLease help.
Private Sub Command7_Click()
Dim strPass As String
strPass = "password"
If Me.txtPassword.Value = strPass Then
UnProtected = True
DoCmd.OpenForm "FrmBankDetails", Wherecondition:=" [StudentName]=" & [cboStudentName] & ""
DoCmd.Close acForm, "FrmBankDetailsLogin", acSaveNo
Else
If MsgBox("You need to enter a valid password, try again?", vbYesNo) = vbNo Then
DoCmd.Close acForm, "FrmBankDetailsLogin", acSaveNo
Else
txtPassword.Value = ""
txtPassword.InputMask = "Password"
End If
End If
End Sub
:banghead::banghead::banghead::banghead:
I have created a button called 'Bank Details' when clicked it opens a small form asking you to enter a 'password'
Once this operation has been done and clicked the enter button I want FrmBankDetails to open to a specific record that relates to a record from FrmAdmin.
The textbox in FrmAdmin is called 'StudentName' and the cbobox in FrmBankDetails is called cboStudentName.
This just doesn't work and have tried various ways. I know it can be done using Macros because I've done it, I need it in VBA so that the 'password' works.
PLease help.
Private Sub Command7_Click()
Dim strPass As String
strPass = "password"
If Me.txtPassword.Value = strPass Then
UnProtected = True
DoCmd.OpenForm "FrmBankDetails", Wherecondition:=" [StudentName]=" & [cboStudentName] & ""
DoCmd.Close acForm, "FrmBankDetailsLogin", acSaveNo
Else
If MsgBox("You need to enter a valid password, try again?", vbYesNo) = vbNo Then
DoCmd.Close acForm, "FrmBankDetailsLogin", acSaveNo
Else
txtPassword.Value = ""
txtPassword.InputMask = "Password"
End If
End If
End Sub
:banghead::banghead::banghead::banghead: