John,
Thanks for the code.
This is the code I have attached to the "Approve1" button on the
frmCCR_Revise form:
Private Sub cmdRVP_Click()
On Error GoTo Err_cmdRVP_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmRVPApprove"
stLinkCriteria = "[CCR_ID]=" & Me![CCR_ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdRVP_Click:
Exit Sub
Err_cmdRVP_Click:
MsgBox Err.Description
Resume Exit_cmdRVP_Click
End Sub
I was wondering if you could help me with the following:
Private Sub cmdTitleApprove_Click()
'Check to see if data is entered into the Title combo box
If IsNull(Me.cmdTitle) Or Me.cmdTitle = "" Then
MsgBox "You must select a Region.", vbOKOnly, "REQUIRED DATA"
Me.cmdTitle.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.txtTitlePassword) Or Me.txtTitlePassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "REQUIRED DATA"
Me.txtTitlePassword.SetFocus
Exit Sub
End If
'Check value of password in the tblTitle table to see if this
'matches value chose in the combo box
If Me.txtTitlePassword.Value = DLookup("strPassword", "tblTitle",
"[TitleID]=" & Me.cmdTitle.Value) Then
TitleID = Me.cmdTitle.Value
***********If the password match, I want the system to insert the name of
the person in the frmCCR_Revise form here and close this form***************
'Close logon form and open the frmCCR_Revise
Else
MsgBox "Password Invalid. Please Try Again.", vbOKOnly, "INVALID ENTRY!"
Me.txtTitlePassword.SetFocus
End If
'If User Enter incorrect password 3 times database will shut down
intLogonAttempts = intLogonAttempt + 1
If intLogonAttempts > 3 Then
MsgBox "You do not have access to this database. Please contact the
Databas Administrator.", vbCritical, "RESTRICTED ACCESS!"
Application.Quit
End If
Exit_cmdGoTypeForm_Click:
Exit Sub
Err_cmdGoTypeForm_Click:
MsgBox Err.Description
Resume Exit_cmdGoTypeForm_Click
End Sub
J_Goddard via AccessMonster.com said:
Hi -
I'm assuming that the names of the persons giving the approvals are kept in
the table underlying your main form, and that the three corresponding
controls on the form are [person1], [person2] and [person3], and that the
approval buttons are Approval1, 2 and 3 you could put something like this in
the On Current event of the form:
me!Approval1.enabled = True
me!Approval2.enabled = True
me!Approval3.enabled = True
if len(trim(nz(me![Person1],""))) > 0 then me!Approval1.enabled = False
if len(trim(nz(me![Person2],""))) > 0 then me!Approval2.enabled = False
if len(trim(nz(me![Person3],""))) > 0 then me!Approval3.enabled = False
This first resets all the Approval buttons to enabled, then disables those
where the approval has already been given. This part: len(trim(nz(me!
[Person1],""))) > 0 converts nulls to zero-length strings, removes any
leading/trailing blanks, and checks the length of the resulting string. It
covers all cases of no data ( Blank <> Zero length string <> Null).
HTH
John
Trini said:
Hi,
Thanks for your suggestion, I didn't even think about that. Do you have any
code to get me started?
[quoted text clipped - 23 lines]
--
John Goddard
Ottawa, ON Canada
jrgoddard at cyberus dot ca
.