Hi,
I have been developing a system which has a vb4.0 front end and a access 95 database for several years.
I have recently converted to using VB6(sp5) and an Access 2000 database and I have upgraded to using DAO 3.6. Everything seems fine except for when I add new records.
If I have a recordset that has a numeric field, and the default value is 22 then adding a new record gives different results depending on whether I have records in the recordset or not.
If I set up a recordset with records already in it:
(Before Adding New, the recordset is at the first record and bound text boxes are showing the correct values from the underlying data)
Add a New record.
The text box which is bound to the numeric field with the default value of 22, now displays 22.
Now I update the record. The data is as expected (default value is 22)
If I set up a recordset with NO records in it:
(Before Adding New, there is no record to show so all bound text boxes are blank)
Add a New record.
The text box which is bound to the numeric field with the default value of 22, does not change, it is still blank!
Now I update the record. The data has got the default value of 22.
This DID NOT happen when using VB4 and Access 95!
I don't know if there is an easy way round this. After adding new I can populate the text boxes with the default values. Or I could add in a dummy record first and then delete it.
Either of these two methods is not ideal as the program has hundreds of
places that have this kind of behaviour.
Is there a simple way of "refreshing" the text box after adding new? I have tried the UpdateControls method and it doesn't seem to do anything.
Any help on this would be greatly appreciated!
Steve Davis