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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Cannot access selected table" problem with cursor 1

Status
Not open for further replies.

jworley

Programmer
Jun 19, 2000
36
GB
Hi,

I have a listbox populated by data from a cursor that is created as a result of an SQL query. The listbox is used on a form that allows a user to select single records for deletion. Having deleted the desired record, I run the original SQL query again to update the listbox. When I wrote the code it worked fine, but all of a sudden it has started to return "Cannot access selected table" when the listbox is updated.

I have designed a method on the main form that clears some of the other text boxes populated by the data that the user wishes to delete, subsequent to deletion. I have discovered that if I comment out the call to this method, the problem outlined above disappears. However, this method was in use to begin with and worked fine also.

Is this some kind of scoping issue ?

Jim Worley
jim@aits-uk.net
 
The possible reason could be
1. The new routine is setting the default DBF to something else thru' refresh event. Possible remedy.. SELECT myDBF before the requery every time you requery.
2. You have been caught in a trap of file locking or record locking or transaction processing and exiting it without clearing the lock. You can attend that if you are doing it.

If more help needed, please post more of specific code if possible to me so that I can try to help you out of this.
ramani :)
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
Hi,
Before you run the query, set the rowsourcetype of the listbox to 0, then run the query, and set the list box rowsourcetype back to alias, or fields (which ever one you used) after the query cursor has been created.
I think that running the query temporarily deletes the cursor used by the list box and this is where the message is coming from.

Wayne
 
Hello.

Another possible cause can be other combo having the RowSource in the same cursor. I had once this problem and it took me half a day to debug...

Hope this helps Grigore Dolghin
Class Software
Bucharest, Romania
 
Set your's listBox recordsourcetype towards a array, array wich will be updated through a SQL. Have fun !!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top