[RESOLVED] You canceled the previous operation?
I have a form tied to a record set. On this form I also have 2 unbounded combo boxes (Archive and id). The combo boxes are used to filter out on the 2 fields present in the recordset/form. The combo boxes are populated with acceptable values from the base table.
When an archive combo box value is selected, the form recordset is updated accordingly. I use me.recordsource to reset the form records. In addition, the ID combo box is updated with acceptable values for a given archive value. All this is done in the AfterUpdate event for the archive combo box. This works fine.
The next step is to select the combo box ID value. This is where my problems occurs. Once a value is selected, I take the archive combo box value and the ID combo box value and reset the form recordsource again.
However, Access chokes on the me.recordsource statement with the error 'You canceled the previous operation'. I can't figure out how to fix it. Any ideas?
Re: You canceled the previous operation?
post your code, so we can see
pete
Re: You canceled the previous operation?
Here's my code:
VB Code:
Option Compare Database
Option Explicit
Private Sub cmbSelectID_AfterUpdate()
''This statement causes the error
Me.RecordSource = "SELECT [NOV Report].*, [NOV Report].[ID#] FROM [NOV Report] WHERE ((([NOV Report].[ID#])=" & cmbSelectID.Value & ") AND (([NOV Report].ArchiveNumber)=" & cmbArchive.Value & "));"
End Sub
Private Sub cmbArchive_AfterUpdate()
Me.RecordSource = "SELECT [NOV Report].* FROM [NOV Report] WHERE ((([NOV Report].ArchiveNumber)=" & cmbArchive.Value & "));"
cmbSelectID.RowSource = "SELECT [NOV Report].[ID#] FROM [NOV Report] WHERE ((([NOV Report].ArchiveNumber)=" & cmbArchive.Value & "));"
End Sub
Re: You canceled the previous operation?
Try this
Form Recored source property:
"SELECT [NOV Report].*, [NOV Report].[ID#] FROM [NOV Report] WHERE ((([NOV Report].[ID#])=Forms![YourFormName]![cmbSelectID]) AND (([NOV Report].ArchiveNumber)=Forms![YourFormName]![cmbArchive]));"
cmbSelectID control source property:
"SELECT [NOV Report].[ID#] FROM [NOV Report] WHERE ((([NOV Report].ArchiveNumber)=Forms![YourFormName]![cmbArchive]));"
Set the cmbArchive boud column property to ArchiveNumber column-1 (Starting form 0)
Set the cmbSelectID 0 (Zero) Or boud column property to cmbSelectID column-1 (Starting form 0)
Your VB code:
Private Sub cmbSelectID_AfterUpdate()
Me.Requery
End Sub
Private Sub cmbArchive_AfterUpdate()
Me.Requery
cmbSelectID.Requery
End Sub
Re: You canceled the previous operation?
Great catch. Although it did not work entirely, I tweak it a little and had it working.
Thanks