D
Dimitris Nikolakakis
I have a form FOfferTransform and I have put a button to do the following:
*******************************************************************
Dim x As Integer
x = DCount("OrderID", "Orders", "[OrderID] = Forms![
FOfferTransform]!Text3")
If x <> 0 Then
Dim Response
Response = MsgBox("my message!", vbOKOnly, "my message")
Me.ActiveControl.Undo
Else
DoCmd.SetWarnings False
DoCmd.OpenQuery "qOfferTransform_1", acViewNormal, acEdit
DoCmd.OpenQuery "qOfferTransform_2", acViewNormal, acEdit
DoCmd.OpenQuery "qOfferTransform_3", acViewNormal, acEdit
DoCmd.Close acForm, "FOrders"
DoCmd.SetWarnings True
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "FOrders"
stLinkCriteria = "[OrderID]+[TypeID]=" & "'" & Me![Text3] + "ORD" & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "FOfferTransform"
End If
*******************************************************************
I get debug error:
Run-time error 2001:
You canceled the previous operation.
If I click debug the cursor is no line:
x = DCount("OrderID", "Orders", "[OrderID] = Forms![
FOfferTransform]!Text3")
If I remove the 'IF ... ... Then ... ... Else' and I just put the
...............
DoCmd.SetWarnings False
DoCmd.OpenQuery "qOfferTransform_1", acViewNormal, acEdit
DoCmd.OpenQuery "qOfferTransform_2", acViewNormal, acEdit
DoCmd.OpenQuery "qOfferTransform_3", acViewNormal, acEdit
DoCmd.Close acForm, "FOrders"
DoCmd.SetWarnings True
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "FOrders"
stLinkCriteria = "[OrderID]+[TypeID]=" & "'" & Me![Text3] + "ORD" & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "FOfferTransform"
............. it works fine.
Thanks in advance
Dimitris Nikolakakis
*******************************************************************
Dim x As Integer
x = DCount("OrderID", "Orders", "[OrderID] = Forms![
FOfferTransform]!Text3")
If x <> 0 Then
Dim Response
Response = MsgBox("my message!", vbOKOnly, "my message")
Me.ActiveControl.Undo
Else
DoCmd.SetWarnings False
DoCmd.OpenQuery "qOfferTransform_1", acViewNormal, acEdit
DoCmd.OpenQuery "qOfferTransform_2", acViewNormal, acEdit
DoCmd.OpenQuery "qOfferTransform_3", acViewNormal, acEdit
DoCmd.Close acForm, "FOrders"
DoCmd.SetWarnings True
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "FOrders"
stLinkCriteria = "[OrderID]+[TypeID]=" & "'" & Me![Text3] + "ORD" & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "FOfferTransform"
End If
*******************************************************************
I get debug error:
Run-time error 2001:
You canceled the previous operation.
If I click debug the cursor is no line:
x = DCount("OrderID", "Orders", "[OrderID] = Forms![
FOfferTransform]!Text3")
If I remove the 'IF ... ... Then ... ... Else' and I just put the
...............
DoCmd.SetWarnings False
DoCmd.OpenQuery "qOfferTransform_1", acViewNormal, acEdit
DoCmd.OpenQuery "qOfferTransform_2", acViewNormal, acEdit
DoCmd.OpenQuery "qOfferTransform_3", acViewNormal, acEdit
DoCmd.Close acForm, "FOrders"
DoCmd.SetWarnings True
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "FOrders"
stLinkCriteria = "[OrderID]+[TypeID]=" & "'" & Me![Text3] + "ORD" & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "FOfferTransform"
............. it works fine.
Thanks in advance
Dimitris Nikolakakis