Hello and thank you for any attention my post may receive.
Windows
Access 2013
I am trying to open a form (frmApproveInitiate) from another form (frmPassword). The user enters the ID number into Text0 on frmPassword and then OK. I added a second criteria where only open the form if table 'Main' fields 'ID' matches and the corresponding field 'Expected Duration' value is > 12.
My code returns Run-time error '2465': can't find field '|1' referred to in the expression. The line of code which has the issue is highlighted in bold below.
My unsuccessful code so far is this:
Thank you and have a great day.
Windows
Access 2013
I am trying to open a form (frmApproveInitiate) from another form (frmPassword). The user enters the ID number into Text0 on frmPassword and then OK. I added a second criteria where only open the form if table 'Main' fields 'ID' matches and the corresponding field 'Expected Duration' value is > 12.
My code returns Run-time error '2465': can't find field '|1' referred to in the expression. The line of code which has the issue is highlighted in bold below.
My unsuccessful code so far is this:
Code:
Private Sub Command3_Click()
On Error GoTo Err_Command3_Click
If IsNull(Me.Text0) Or Me.Text0 = "" Then 'Check that textbox is not Null and not a zero length string
MsgBox "Whoa there. You have forgotten to enter an Override ID. Please answer 'OK' then try again."
Me.Text0.SetFocus
' Cancel = True
Exit Sub
End If
If DCount("ID", "Main", "ID = " & Me.Text0) = 0 Then 'Check that the input ID exists
MsgBox "Please enter a valid Override ID"
Me.Text0.SetFocus
' Cancel = True
Exit Sub
End If
[B]If DCount("ID", "Main", "ID = " & Me.Text0 And [Expected Duration] > 12) = 1 Then[/B]
MsgBox "You do not have authority to approve this Override."
Me.Text0.SetFocus
Exit Sub
End If
DoCmd.OpenForm "frmApproveInitiate", , , , datamode:=acFormEdit, windowmode:=acDialog
Me.Text0.Value = ""
Exit_Command3_Click:
Exit Sub
Err_Command3_Click:
MsgBox Err.Description
Resume Exit_Command3_Click
End Sub
Thank you and have a great day.