I changed my primary key data type from integer to text, but when I go to open form using the primary key selected from the combo box, I receive the following message:
Microsoft Access
Run-time error '2501':
The OpenForm action was canceled.
You used a method of the DoCmd object to carry out an action in Visual Basic, but then clicked Cancel in a dialog box.
For example, you used the Close method to close a changed form, then clicked Cancel in the dialog box that asks if you want to save the changes you made to the form.
I have included the code below:
Private Sub cmdNext_Click()
Dim stDocName As String
Dim stLinkCriteria As String
Dim var As Variant
var = Forms![frmMaintainableItemParentSelection]![cmboMaintainableItemParentTag]
If IsNull(var) Then
MsgBox "No Maintainable Item Parent Tag has been selected, please select a maintainable Item Parent Tag", , "Maintainable Item Parent Tag Warning"
Else
stDocName = "frmEditMaintainableItemParentData"
stLinkCriteria = "[MaintainableItemParentTag]=" &
Me![cmboMaintainableItemParentTag]
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit
End If
End Sub
The program stops at this line:
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit
Any help would be appreciated.
Regards
PADFOR
Microsoft Access
Run-time error '2501':
The OpenForm action was canceled.
You used a method of the DoCmd object to carry out an action in Visual Basic, but then clicked Cancel in a dialog box.
For example, you used the Close method to close a changed form, then clicked Cancel in the dialog box that asks if you want to save the changes you made to the form.
I have included the code below:
Private Sub cmdNext_Click()
Dim stDocName As String
Dim stLinkCriteria As String
Dim var As Variant
var = Forms![frmMaintainableItemParentSelection]![cmboMaintainableItemParentTag]
If IsNull(var) Then
MsgBox "No Maintainable Item Parent Tag has been selected, please select a maintainable Item Parent Tag", , "Maintainable Item Parent Tag Warning"
Else
stDocName = "frmEditMaintainableItemParentData"
stLinkCriteria = "[MaintainableItemParentTag]=" &
Me![cmboMaintainableItemParentTag]
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit
End If
End Sub
The program stops at this line:
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit
Any help would be appreciated.
Regards
PADFOR