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

ADO commits

Status
Not open for further replies.

jrlbw

Programmer
Jun 27, 2002
15
US
I have an application using Access 2000 and VB6. I retrieve all rows from the database using connection string and recordset. When I do inserts or updates I use the command object, after building my SQL statement. It inserts and updates just fine. However, when I insert, the new row does not show until I exit the app and come back in. I can do a close recordset, open recordset, movefirst or movelast, but the new row does not show. Only by completely exiting the app and returning, does it show up. What am I doing wrong?????
thanks
 
If you are using MS ADODC and MS DataGrid Control, I can help, otherwise not. I had this problem a few days ago and it is 99% solved.

When adding an ADODC to the form, set the connection string property ut leave the recordSource property blank.

When putting the datagrid on the form, leave the datasource property blank.

Whenever you need to refresh the datagrid, set the properties in code.

mySQL = "your statement"

Adodc1.RecordSource = mySQL
Adodc1.Refresh
set DataGrid1.DataSource = Adodc1
DataGrid1.Refresh

MsgBox("Updating")

The 1% unsolved portion is that I need to add the little msgbox to get the refresh to actually show... If you can figure out how to do it without the msgbox (a sleep or pause function or what have you), I'd love to see you post it here.

I hope this helps
PB
 
no,,,I am not using an adoc control on the form...
I am doing all SQL in code and connecting, inserting, updating, deleting using the connection, recordset and command objects. Still having the problem of refreshing....
I used Resync but it works sometimes, not others...
Don't know...it is weird...
 
Can you post your code? I've had a short delay now and again between doing as rs.update and being able to see the new data but never had to close the app and start over.
 
1. use the same connection for all ADO operations or use the JRO RefreshCache method.

Also, if a recordset based on the same table as the INSERT/UPDATE, and was open prior to the action query, remains open after the action query, you will need to requery it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top