Data Bound Grid problem [RESOLVED]
Hey all,
I'm using a data bound grid with an ado data connection. My db is Access '03 using MDAC 2.7. My problem is, after data is entered into the db, the dbg isn't refreshing properly, its always one record behind, i.e. after the first record is entered, the grid is blank, after the second record is entered, the first record displays in the grid. I never had this problem with SQL 2000, but Access is causing me no end of grief with this. Here's the code I'm using to display the grid after each insert:
strSQL = "Select * from MyTable"
AdoTrack.ConnectionString = cnnMydb
AdoTrack.RecordSource = strSQL
AdoTrack.CursorType = adOpenDynamic
AdoTrack.LockType = adLockPessimistic
AdoTrack.Refresh
dbgTrack.ReBind
Any ideas? Thanks in advance.
Re: Data Bound Grid problem
Welcome to VBF!
Give this a try....
VB Code:
AdoTrack.ConnectionString = cnnMydb
AdoTrack.RecordSource = strSQL
AdoTrack.CursorType = adOpenDynamic
[B]AdoTrack.CursorLocation = adUseClient[/B]
AdoTrack.LockType = adLockPessimistic
AdoTrack.Refresh
dbgTrack.ReBind
Re: Data Bound Grid problem
Thanks for the welcome :)
I added the code as you suggested, still does the same thing. Any other suggestions?
Thanks
Re: Data Bound Grid problem [RESOLVED]
Well, I found a work around for my problem. It's not pretty, but it does the job. Basically, I've found that if I open the recordset and then close it and then open the data grid, the data is all there. Apparently, it's some kind of timing issue, the data grid is fetching faster than the data is posting. It must be something to do with the Access connection string, because I don't have this problem with SQL2000.