I am having problems refreshing the contents of a bound data grid when I add a new row. The problem only lies in fields which are from “lookup” tables.
I am using a datagrid (datagrid control 6.0 (OLEDB)) in VB6 linked to a command object of a DataEnvironment (DE) (which linked to a SQL Server 7 database).
I am using ADO (2.1) to access the data in the database
There are several fields in the main table in the database which store numeric values which link to fields in lookup tables which have text descriptions in them.
I set up a command object under the DE which shows the numeric fields from the main database table and the equivalent text descriptions from the lookups.
I drop the datagrid on the form and set the datasource and datamember at design time – when I load the form everything is shows OK in the datagrid. I then have a command button which loads a data input form to add a new record to the grid. Having added the data I do a recordset.update and return to the form with the datagrid on it – all fields have updated OK except those which show the values from the lookup tables.
If I close down the app and then run it again, the datagrid shows all the new values including the lookup fields
Any ideas how to solve this ?