J
John Ortt
I have copied some code from another form which opens a form to display
certain information.
I have changed the relevant bits (I.E module name, form name and field name)
but otherwise left it the same
Still it wont work. I get the following error message:
/////////////////////////////////////
Run-time error '2501':
The OpenForm action was cancelled.
You used a method of the DoCmd object to carry out an action in visual
Basic, but then clicked cancel in a dialogue box.
For example, you used the close method to close a changed form, then clicked
cancel in the dialogue box that asked you if you want to save the changes
you made to the form.
////////////////////////////////////
my new code is as follows:
____________________
Private Sub Supplier_DblClick(Cancel As Integer)
Link
End Sub
Function Link()
Dim stDocName As String
Dim stLinkCriteria As String
Dim stLinkCriteria1 As String
stDocName = "FartViewerSub"
stLinkCriteria = "[Key]=" & "'" & Me![Key] & "'"
MsgBox (stLinkCriteria)
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Function
The Original (working code) is as follows:
_______________________________
Private Sub CUSTOMER_2_DblClick(Cancel As Integer)
Link
End Sub
Function Link()
Dim stDocName As String
Dim stLinkCriteria As String
Dim stLinkCriteria1 As String
Dim stLinkCriteria2 As String
Dim stLinkCriteria3 As String
Dim stLinkCriteria4 As String
stDocName = "VendorMarginsDDForm"
stLinkCriteria1 = "[TYPE]=" & "'" & Me![TYPE] & "'"
stLinkCriteria2 = "[IPT]=" & "'" & Me![IPT] & "'"
stLinkCriteria3 = "[CUSTOMER_2]=" & "'" & Me![CUSTOMER_2] & "'"
stLinkCriteria4 = "[SD Forecast]=" & "'" & Me![SD Forecast] & "'"
stLinkCriteria = stLinkCriteria1 & " and " & stLinkCriteria2 & " and " &
stLinkCriteria3 & " and " & stLinkCriteria4
docmd.Openform stDocName, , , stLinkCriteria
End Function
certain information.
I have changed the relevant bits (I.E module name, form name and field name)
but otherwise left it the same
Still it wont work. I get the following error message:
/////////////////////////////////////
Run-time error '2501':
The OpenForm action was cancelled.
You used a method of the DoCmd object to carry out an action in visual
Basic, but then clicked cancel in a dialogue box.
For example, you used the close method to close a changed form, then clicked
cancel in the dialogue box that asked you if you want to save the changes
you made to the form.
////////////////////////////////////
my new code is as follows:
____________________
Private Sub Supplier_DblClick(Cancel As Integer)
Link
End Sub
Function Link()
Dim stDocName As String
Dim stLinkCriteria As String
Dim stLinkCriteria1 As String
stDocName = "FartViewerSub"
stLinkCriteria = "[Key]=" & "'" & Me![Key] & "'"
MsgBox (stLinkCriteria)
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Function
The Original (working code) is as follows:
_______________________________
Private Sub CUSTOMER_2_DblClick(Cancel As Integer)
Link
End Sub
Function Link()
Dim stDocName As String
Dim stLinkCriteria As String
Dim stLinkCriteria1 As String
Dim stLinkCriteria2 As String
Dim stLinkCriteria3 As String
Dim stLinkCriteria4 As String
stDocName = "VendorMarginsDDForm"
stLinkCriteria1 = "[TYPE]=" & "'" & Me![TYPE] & "'"
stLinkCriteria2 = "[IPT]=" & "'" & Me![IPT] & "'"
stLinkCriteria3 = "[CUSTOMER_2]=" & "'" & Me![CUSTOMER_2] & "'"
stLinkCriteria4 = "[SD Forecast]=" & "'" & Me![SD Forecast] & "'"
stLinkCriteria = stLinkCriteria1 & " and " & stLinkCriteria2 & " and " &
stLinkCriteria3 & " and " & stLinkCriteria4
docmd.Openform stDocName, , , stLinkCriteria
End Function