|
 |
access thread: Error within code
Message #1 by "James Potter" <questionaccess@h...> on Mon, 24 Mar 2003 16:21:11
|
|
Hi there,
I am having a problem when running the following code it produces Run-time
error 2501. It says the OpenForm action was cancelled as Cancel was
clicked in a dialog box.
Can anyone help
Thanks in advance, James .......
Dim strCriteria As String
strCriteria = ""
If (Me.cboArea = "Aluminium") Then
strCriteria = "Employee_No_FK = " & Forms![frmSearchBonusRecord]!
[cboEmployee] & ""
If strCriteria <> "" Then
strCriteria = strCriteria & " and "
End If
strCriteria = strCriteria & "lngFKAluOperation = " & Forms!
[frmSearchBonusRecord]![cboOperation] & ""
If strCriteria <> "" Then
strCriteria = strCriteria & " and "
End If
strCriteria = strCriteria & "dtmAluMon = #" & Format$(CVDate(Forms!
[frmSearchBonusRecord]![txtBonusFrom]), "mm/dd/yy") & "#"
Debug.Print (strCriteria)
DoCmd.OpenForm "frmAluIndividualBonus", , , strCriteria
Forms!frmAluIndividualBonus.Tag = "frmSearchBonusRecord"
Forms!frmSearchBonusRecord.Visible = False
Exit Sub
End If
Message #2 by "Michael.Stalford" <michael.stalford@c...> on Mon, 24 Mar 2003 09:01:30 -0700
|
|
James,
My experience has usually been that error 2501 is not a problem
associated with the code doing the calling, but with the code in the
form that is not allowing the form to open. For instance, you might
want to check the open and load events of the form being opened. The
code in one of these events may be causing the form not to open, which
will result in error 2501 being flagged in the calling procedure.
Hope this helps,
Mike
-----Original Message-----
From: James Potter [mailto:questionaccess@h...]
Sent: Monday, March 24, 2003 4:21 PM
To: Access
Subject: [access] Error within code
Hi there,
I am having a problem when running the following code it produces
Run-time
error 2501. It says the OpenForm action was cancelled as Cancel was
clicked in a dialog box.
Can anyone help
Thanks in advance, James .......
Dim strCriteria As String
strCriteria = ""
If (Me.cboArea = "Aluminium") Then
strCriteria = "Employee_No_FK = " &
Forms![frmSearchBonusRecord]!
[cboEmployee] & ""
If strCriteria <> "" Then
strCriteria = strCriteria & " and "
End If
strCriteria = strCriteria & "lngFKAluOperation = " & Forms!
[frmSearchBonusRecord]![cboOperation] & ""
If strCriteria <> "" Then
strCriteria = strCriteria & " and "
End If
strCriteria = strCriteria & "dtmAluMon = #" &
Format$(CVDate(Forms!
[frmSearchBonusRecord]![txtBonusFrom]), "mm/dd/yy") & "#"
Debug.Print (strCriteria)
DoCmd.OpenForm "frmAluIndividualBonus", , , strCriteria
Forms!frmAluIndividualBonus.Tag = "frmSearchBonusRecord"
Forms!frmSearchBonusRecord.Visible = False
Exit Sub
End If
|
|
 |