|
-
Jun 1st, 2005, 12:13 PM
#1
Thread Starter
New Member
ADO Refresh
I have a main form, from which I open a another form, frmSchedule
frmSchedule has a datagrid, which is bound to an ado data control
The data control is based on a table called TempSchedule. Before I open frmSchedule, I delete the contents of TempSchedule and replace with a fresh schedule.
However, gridSchedule will be blank. Now if I use a message box after frmSchedule opens, gridSchedule will be filled after I click ok.
I tried datSchedule.Refresh but that did nothing either. At the moment my code is
VB Code:
stSQL = "DELETE * FROM TempSchedule"
cnnAsset.Execute stSQL
stSQL = "INSERT INTO TempSchedule SELECT Schedule.* From Schedule " & _
"WHERE Schedule.Sch_AssetCode = '" & stAssetCode & "'"
cnnAsset.Execute stSQL, lAffected
frmSchedule.lTotalSchedules = lAffected
Then in the frmSchedule Load event
VB Code:
' Now wait until the schedule data loads
While lCountSchedules < lTotalSchedules
lCountSchedules = Me.datSchedule.Recordset.RecordCount
Me.datSchedule.Refresh
Wend
Surely theres a better way!?
-
Jun 2nd, 2005, 12:20 AM
#2
Re: ADO Refresh
Try....
VB Code:
datSchedule.Recordset.CursorLocation=adUseClient
datSchedule.Recordset.Requery
-
Jun 2nd, 2005, 03:05 AM
#3
Re: ADO Refresh
Sounds like you are deleting the records and adding them. They are there but your app beats them getting there and returns nothing.
This has been noted already, you need to flush the cache with RDO.
I'll edit with a link to a (possibly) related post...
Edit:
Another Thread with links
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Jun 2nd, 2005, 04:30 AM
#4
Thread Starter
New Member
Re: ADO Refresh
That code didn't work. I get
3705: Operation is not allowed when the object is open.
when I try the line
datSchedule.Recordset.CursorLocation=adUseClient
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|