Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Runtime Error 2001 You cancelled the previous operation

Status
Not open for further replies.

carlp69

IS-IT--Management
Sep 23, 2003
157
GB
This is so annoying for such a small DB

I have a link table "dbo_qry_Admin_ExternalAPP" which contains basically EmployeeID, FirstName, Surname and other info on that employee.

I have created a a form "Form1" with the Record Source as "dbo_qry_Admin_ExternalApp" and added to the form all the related fields.

I have also created a combobox "SrchName" with a row source of
Code:
"SELECT dbo_qry_Admin_ExternalApp.EmployeeID, dbo_qry_Admin_ExternalApp.Surname, dbo_qry_Admin_ExternalApp.FirstName FROM dbo_qry_Admin_ExternalApp ORDER BY [Surname]; "
I have added an 'After Update' event to the combobox so that the form goes to the relevant record where EmployeeID = Srchname, with the following code :-
Code:
Private Sub SrchName_AfterUpdate()
    Dim strsql As String
    strsql = "select * from dbo_qry_Admin_ExternalApp  where [EmployeeID] = '" & Me![Srchname] & "'"
    Me.Form.RecordSource = strsql
End Sub

When I execute the form the combo box works fine but when I select an employee it throws up the error Runtime Error....

It is really frustrating as I have created things like this before with no problems!

 
You may try this:
Me.Dirty = False
Me.Form.RecordSource = strsql

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top