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 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.