CJBIRKIN
Drink!
- Local time
- Today, 14:02
- Joined
- May 10, 2002
- Messages
- 255
Hello
I've written this in the on click event of a cmd button
when i run it and it gets to get the form load event of the form i'm opening i get an error (2001) "you cancelled the previous operation" at the line Me.RecordSource = OpenArgs
I don't see how this error can be generated as it would require some intervention between me clicking the cmd button and the form opening.
Any ideas??
Chris
Dim stDocName As String
Dim stLinkCriteria As String
Dim StrMsgStr As String
Dim StrSql As String
Dim COMBO1ID As Variant
Dim COMBO5ID As Variant
Dim COMBO7ID As Variant
stDocName = "APPOINTMENT_SPELL_FRM"
If [Forms]![menu_frm]![Combo1] = 0 Then
COMBO1ID = "*"
Else
COMBO1ID = [Forms]![menu_frm]![Combo1]
End If
If IsNull([Forms]![menu_frm]![Combo5]) = True Then
COMBO5ID = "*"
Else
COMBO5ID = [Forms]![menu_frm]![Combo5]
End If
If IsNull([Forms]![menu_frm]![Combo7]) = True Then
COMBO7ID = "*"
Else
COMBO7ID = [Forms]![menu_frm]![Combo7]
End If
StrSql = "SELECT TBL_PATIENT.*, TBL_SPELL.*" _
& "FROM TBL_PATIENT LEFT JOIN TBL_SPELL ON TBL_PATIENT.PMI = TBL_SPELL.PMI_FK " _
& "WHERE (((TBL_SPELL.CASE_TYPE_FK)=" & "'" & COMBO5ID & "'" & ") AND ((TBL_SPELL.OUTCOME_ID_FK)=" & "'" & COMBO7ID & "'" & ") AND ((IIf([OUTCOME_ID_FK]=0,round((DateDiff('d',[APPOINTMENT_DATE],Date())/7),2),'EPISODE CLOSED'))=" & "'" & COMBO1ID & "'" & "));"
DoCmd.OpenForm stDocName, , , , , , StrSql
I've written this in the on click event of a cmd button
when i run it and it gets to get the form load event of the form i'm opening i get an error (2001) "you cancelled the previous operation" at the line Me.RecordSource = OpenArgs
I don't see how this error can be generated as it would require some intervention between me clicking the cmd button and the form opening.
Any ideas??
Chris
Dim stDocName As String
Dim stLinkCriteria As String
Dim StrMsgStr As String
Dim StrSql As String
Dim COMBO1ID As Variant
Dim COMBO5ID As Variant
Dim COMBO7ID As Variant
stDocName = "APPOINTMENT_SPELL_FRM"
If [Forms]![menu_frm]![Combo1] = 0 Then
COMBO1ID = "*"
Else
COMBO1ID = [Forms]![menu_frm]![Combo1]
End If
If IsNull([Forms]![menu_frm]![Combo5]) = True Then
COMBO5ID = "*"
Else
COMBO5ID = [Forms]![menu_frm]![Combo5]
End If
If IsNull([Forms]![menu_frm]![Combo7]) = True Then
COMBO7ID = "*"
Else
COMBO7ID = [Forms]![menu_frm]![Combo7]
End If
StrSql = "SELECT TBL_PATIENT.*, TBL_SPELL.*" _
& "FROM TBL_PATIENT LEFT JOIN TBL_SPELL ON TBL_PATIENT.PMI = TBL_SPELL.PMI_FK " _
& "WHERE (((TBL_SPELL.CASE_TYPE_FK)=" & "'" & COMBO5ID & "'" & ") AND ((TBL_SPELL.OUTCOME_ID_FK)=" & "'" & COMBO7ID & "'" & ") AND ((IIf([OUTCOME_ID_FK]=0,round((DateDiff('d',[APPOINTMENT_DATE],Date())/7),2),'EPISODE CLOSED'))=" & "'" & COMBO1ID & "'" & "));"
DoCmd.OpenForm stDocName, , , , , , StrSql