The problem is in the way you are creating your recordset, specifically the joins you are using.
have a look at the following for a good description the different joins that are available:
Different SQL JOINs
Before we continue with examples, we will list the types of JOIN you can use, and the differences between them.
* JOIN: Return rows when there is at least one match in both tables
* LEFT JOIN: Return all rows from the left table, even if there are no matches in the right table
* RIGHT JOIN: Return all rows from the right table, even if there are no matches in the left table
* FULL JOIN: Return rows when there is a match in one of the tables
Where you are using left joins in the query, it will still return data from the left tabel, even if there is match found on the right table,
because of this, the recordset is not empty, just the columns you are trying to output.
to double check this, take the query into the MySQL Querybrowser and run it there so you can see exactly what is being returned. The query being run is:
SELECT occupation.ASCOid , asco.ASCO , asco.maindesciption , state.StateID, state.StateDescription , stateoccvisajoin.StateOccVisaID , stateoccvisajoin.V176 , stateoccvisajoin.V886 , stateoccvisajoin.V475 , stateoccvisajoin.V487 FROM Data4ma.asco INNER JOIN Data4ma.occupation ON (asco.AscoASCOid = occupation.ASCOid) LEFT JOIN Data4ma.stateoccvisajoin ON (stateoccvisajoin.SOVOccupationID = occupation.record_id) LEFT JOIN Data4ma.state ON (stateoccvisajoin.SOVStateID = state.StateID) WHERE occupation.record_id = 10 ORDER BY state.StateDescription ASC
Play around with the different join types in the MySQL Querybrowser to see how the effect the results you get.