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

Vb & Access - Can the DB update faster?

Status
Not open for further replies.

BraveDave

Programmer
Jun 16, 2005
9
0
0
US
Hey, another Vb & Access Question -
I have this command that supposed to save changes to db by the Ado.Recordset.Update. I want to update some value (The first letter of some field in the first record and in the last) with each change of the DB.
This is the update command -

Private Sub UpD()
Ado.recordset.update
msgbox(GetLetters ("TblXypher","XypherID")
End Sub

Public Function GetLetters(ReqTbl, ReqField)
With FrmMnu.AddGen
.CommandType = adCmdText
.RecordSource = "SELECT " & ReqField & " FROM " & ReqTbl & " ORDER BY " & ReqField & ";"
.Refresh
.Recordset.MoveFirst
GetLetters = Left(.Recordset(0), 1)
.Recordset.MoveLast
GetLetters = GetLetters & Left(.Recordset(0), 1)
End With
End Function

**notice that I update the DB with one Ado and Query the DB with another ADO**

The problem is that the query still return data that exists before the change were made.
Meaning - the query doesn't update in time. If I run the GetLetters function a second later the correct, update result is showen.
I even tried to update the DB by an SQL command, and even added the DoEvents commannd before running the GetLEtters function. Still got the values that were before the update.
I understand that the query can't update so quickly.
Is there something to do about it? Is there a command that will force it to update before the query? Do you think the problem won't exist with anbother DB, for example MySQL?
Thank you very much,
Dave.
 
I have been using asynchronous ADO for some time now but I know that you can query a synchronous connection to ask if it is complete so is this not possible with synchronous ADO ? This example uses an asynchronous stored procedure but its the principal that counts, asking the storing recordset if its still executing before you make the query to the same database.


Take care .stillexecuting may not be the correct command in your case - do some research.

Boggg1
[bigglasses]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top