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!

Combo Box on grid and exit problem

Status
Not open for further replies.

jmcfarlane

Programmer
Mar 21, 2001
21
CA
I have a grid on the main form. Within that grid is a combo box populated by the init event via sql, the rowsource is cleared when the focus is lost and repopulated when the control gets the focus again. The problem I am having is when the combo box is the currently selected control and I go to the exit in the menu or click on the close window (X) icon. This causes a 'Cannot access the selected table error'?

Does anyone have any ideas for a solution.

Jason
 
Solution was to execute the lostfocus event for the combobox in the grid. The code within the combobox lostfocus event was to clear the rowsource.

Jason
 
Explicitly select the alias needed to be focused in the close event.

You get the error, because the default alias IS the rowsource of the combobox, when it remains under focus. The lost focus event sould select the required alias explicitly so that the forms close event firing selects the correct alias. OR you can suitably select the alias which is involved the close event of the form.

If you are having DBF closing codes i the close event, you can shift it to Destroy event of the form.

ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top