T
Taz
Hi,
I am querying the tasks from a MS Project file to get their WBS and
PercentComplete.
Getting these values works fine, but once they get updated (e.g. the
%complete changes from 25 to 100), I can't seem to get the new values.
I keep getting the 25 instead of the 100
If the file gets saved, then, after a while, I get the new value.
Why is it that I don't get the new value immediately? Is there some kind of
delay?
Is it possible to get the new values, even when te file is not saved?
Here is the code I use:
Public Sub GetData()
Dim strSQL As String
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Const strConn As String = "Provider=Microsoft.Project.OLEDB.10.0;PROJECT
NAME=C:\test.mpp"
cn.CursorLocation = ADODB.CursorLocationEnum.adUseClient
cn.Open(strConn)
strSQL = "SELECT * FROM Tasks WHERE TaskNumber1 = '1'"
rs.Open(strSQL, cn)
If Not rs.EOF Then
TextBox1.Text += "id = " & rs("TaskWBS").Value & " / %complete = " &
rs("TaskPercentComplete").Value & vbCrLf
Else
TextBox1.Text += "not found!"
End If
cn.Close()
rs = Nothing
cn = Nothing
End Sub
I am querying the tasks from a MS Project file to get their WBS and
PercentComplete.
Getting these values works fine, but once they get updated (e.g. the
%complete changes from 25 to 100), I can't seem to get the new values.
I keep getting the 25 instead of the 100
If the file gets saved, then, after a while, I get the new value.
Why is it that I don't get the new value immediately? Is there some kind of
delay?
Is it possible to get the new values, even when te file is not saved?
Here is the code I use:
Public Sub GetData()
Dim strSQL As String
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Const strConn As String = "Provider=Microsoft.Project.OLEDB.10.0;PROJECT
NAME=C:\test.mpp"
cn.CursorLocation = ADODB.CursorLocationEnum.adUseClient
cn.Open(strConn)
strSQL = "SELECT * FROM Tasks WHERE TaskNumber1 = '1'"
rs.Open(strSQL, cn)
If Not rs.EOF Then
TextBox1.Text += "id = " & rs("TaskWBS").Value & " / %complete = " &
rs("TaskPercentComplete").Value & vbCrLf
Else
TextBox1.Text += "not found!"
End If
cn.Close()
rs = Nothing
cn = Nothing
End Sub