(Access 2003, VB6.3, Windows XP)
Runtime Error 2001: You cancelled the previous operation.
The highlighted line is the one where the recordsource is set to a previously defined SQL statement. What I don't understand is that the code was working perfectly for a long time and it suddenly appeared.
Here's what my program does
- search for items based on the owner/item type etc which is all entered by combo boxes on a form.
- Once OK is clicked, it launches another form, with 2 subforms in it. At that time, based on those combo boxes the recordsource for both subforms are set.
Depending on the combo box options, the SQL statement's Where clause is altered accordingly.
-It looks something like
Expand|Select|Wrap|Line Numbers
- Dim A as String
- Dim B as String
- Dim SQL as String
- If ComboBoxA = Something Then
- A = " Criteria X"
- End If
- If ComboBoxB = Otherthing Then
- B =" Criteria Y"
- SQL = Select * from Table Where Criteria Z & A & B & Order by Something
- SubformRecordsource = SQL 'this line is highlighted