ADODB/DataGrid

Smitha
10-03-2000, 01:10 AM
Hi, I am using the ADODB code for desigining the database Application. I have used the master/detail form where datagrid is used for the detail table.Relation between master & detail is one to many. I want to calculate the difference of qty received & qty rejected & write into the final qty received in the detail table. if the record is already available this works fine for the event rowcolchange but if a new record is appended I am getting an error message of "row not found" plz. help me is solving this problem.

anhmytran
03-15-2001, 01:48 PM
Your Application needs sometime after refreshing the newly appended Data.
Do the followings:
ConnectionObjec or CommandObject.Execute an Insert SQL command to AddNew record
Run an API call to wait for 2 seconds or more, for the new record to be saved, and ready.
RecordsetObject.Requery a Select SQL command to retrieve the recordset.

Here is the API call:
Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Here is how it is called:
Private Sub cmdRefresh_Click()
cnn.Execute "INSERT INTO bla bla;"
cnn.CommitTrans
Sleep (2000)
rec.Open "SELECT bla bla FROM bla bla:"
or
rec.Requery

AnhMy_Tran

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum