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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating a recordset

Status
Not open for further replies.

chrisgarvey

Technical User
Mar 27, 2003
64
GB
Hello.

I have a form with two text boxes on it.

These are linked using a data control to a access db.

I am creating a report of the items in the db using VB 6 built in report facility.

I have created a button to allow users to enter new items into the db using the text boxes that are bound to the recordset. following code:

datJewellery.Recordset.AddNew
txtJewelleryItem.SetFocus

My problem is that when i add a new record, it does not update the db until a close the program down and open it again. Thus my reports are not up to date.

I have tried playing with

data1.recordset.update
data1.recordset.save
data1.recorset.refresh

But am usure under which object to place these commands

Any help with this would be much appreciated,

Chris.
 
Try wrapping the update in a transaction and use this optional argument when committing:

DAO.CommitTrans dbForceOSFlush

That will flush the write cache.

Then, use this to refresh the read cache:
DBEngine.Idle dbRefreshCache

Or, use the same recordset object, or database object for the Report's DataSource.
 
Thanks for that idea LostInCode.

How do I use the same recordset object to update my reports data source?
 
Remove the Database and RecordSource properties from the report's Data1 data control, and then set the report's data control recordset to that of the grid's:

Set Report1.rptData1.Recordset = Form1.grdData1.Recordset
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top