I must be doing something wrong somewhere!
Taking on board your advice I have tackled the problem in three ways
1. Using Andy Kramek's foxite blog and the first section of 'Safe Select' code
2. Using Andy Kramek's foxite blog and the second section of 'Safe Select' code creating a 'safeselect' method on the form.
3. Using the code snippet examples in your reply
-------------------------------------------
First Way
I think that this got me the closest to achieving my goals.
I placed the safe select code in the combobox IAC method. The code ran without a hitch but at the end all I could see where the grid lines by no data. I placed a break in the code so that I could look at the cursor. The cursor was there with the correct data in it. For some reason I seem not to be pointing the controlsources of the grid columns to the cursor. After the safe select code has run I have code that sets the property of the grid; i.e.
RowSourceType = 4
RowSource = sqlTxt (a variable containing the SQL statement)
....... .ControlSource = cursor.fieldname (for each column)
-------------------------------------------
Second Way
I created a new form method and placed the safe select code in it.
The method is then called from the combobox IAC by using "THISFORM.safeselect(param1,param2)", param1 being a variable containing the SQL Select statement, and param2 being the name of the cursor from which the grid is to obtain its data.
When a selection is made from the combobox the code stops at ZAP IN (tcAlias) with an error message "File is open in another work area'. By reference to the debugger screen the local variable lnSelect has a value of 1.
-------------------------------------------
Third Way
In the form's load method the cursor is created.
The grid is populated with all records when the form is activated.
Your code snippet is then place in the combobox IAC.
When a selection is made from the combobox the code stops at ZAP IN GridCursor with an error message "File is open in another work area'. If I ignore the error the code stops at the next line INSERT INTO ..... with an error message "Cannot update the cursor GridCursor, since it is read only'.
-------------------------------------------
As each way actually creates the cursor is the .grid.recordsourcetype = 4 still correct
Any suggestions please as to why the Safe Select method does not work for me