You cancelled the previous operation Error.

B

boblarson

There's a lot of situations you could get this in. From a null value being
returned in a DLookup, to trying to run a process such as an update in a
before update event.

Can you be more specific as to when you get it?
--
Bob Larson
Access MVP
Access World Forums Administrator
Utter Access VIP

Tutorials at http://www.btabdevelopment.com

__________________________________
 
A

Ayo

This is the code I was running when I get the error on:
"Me.subSiteInformation.Form.RecordSource = strFilterSQL"

Private Sub cmdFilterRecords_Click()
Dim strFilterSQL As String, intlen As Integer
Dim dbsCurrent As Database
Dim qdfNew As QueryDef, rstNew As Recordset
Dim ctrl As Control

Set dbsCurrent = CurrentDb
strFilterSQL = "SELECT * FROM tbl_SiteInformation INNER JOIN
tbl_SiteConfiguration_GSM ON (tbl_SiteInformation.RevNumber =
tbl_SiteConfiguration_GSM.RevNumber) AND (tbl_SiteInformation.ProjectName =
tbl_SiteConfiguration_GSM.ProjectName) AND (tbl_SiteInformation.SiteID =
tbl_SiteConfiguration_GSM.SiteID) WHERE"

For Each ctrl In Me.Controls
With ctrl
Select Case .ControlType
Case acComboBox
If .Enabled = True And .Tag = "Filters" Then
If Not IsNull(.Value) Then
strFilterSQL = strFilterSQL & "
tbl_SiteInformation." & Mid(.Name, 4) & "='" & .Value & "' AND"
End If
End If
End Select
End With
Next ctrl

If Right(strFilterSQL, 5) = "WHERE" Then
Me.subSiteInformation.Form.RecordSource = "SELECT * FROM
tbl_SiteInformation INNER JOIN tbl_SiteConfiguration_GSM ON
(tbl_SiteInformation.RevNumber = tbl_SiteConfiguration_GSM.RevNumber) AND
(tbl_SiteInformation.ProjectName = tbl_SiteConfiguration_GSM.ProjectName) AND
(tbl_SiteInformation.SiteID = tbl_SiteConfiguration_GSM.SiteID) WHERE FALSE"
ElseIf Right(strFilterSQL, 4) = " AND" Then
intlen = Len(strFilterSQL)
strFilterSQL = Mid(strFilterSQL, 1, intlen - 4)
Me.subSiteInformation.Form.RecordSource = strFilterSQL
Set qdfNew = dbsCurrent.CreateQueryDef("NewQueryDef", strFilterSQL)
With qdfNew
Set rstNew = .OpenRecordset(dbOpenSnapshot)
With rstNew
If .RecordCount > 0 Then
Me.cmdGSMConfig.Enabled = True
Me.cmdSiteInfo.Enabled = True
Me.cmdUMTSConfig.Enabled = True
ElseIf .RecordCount = 0 Then
Me.cmdGSMConfig.Enabled = False
Me.cmdSiteInfo.Enabled = False
Me.cmdUMTSConfig.Enabled = False
End If
End With
End With
dbsCurrent.QueryDefs.Delete "NewQueryDef"
End If

End Sub
 
D

Douglas J. Steele

Try closing your recordset before you delete the query on which it's based.
 
T

tedmi

The most frequent cause of this message is referencing a non-eixtent field in
a filter expression. Yeah, I know it makes no sense...
 
B

boblarson

tedmi:

That may be the most frequent where you've seen it, but I have to disagree
with that it is most frequently seen due to that. I have seen it in almost
equal proportions in DLookups as well as the filter, or use in events.
--
Bob Larson
Access MVP
Access World Forums Administrator
Utter Access VIP

Tutorials at http://www.btabdevelopment.com

__________________________________
 
Top