06-02-2014 05:00 AM - edited 06-02-2014 05:01 AM
When browsing through the properties of my connected data store I get an error message when trying to read the property value of "storage date/time": Object doesn't support this property or method.
Here is a minimum example:
Dim oMyDataStore, MyProperty, oMyProperties Set oMyDataStore = Navigator.ConnectDataStoreByParameter("TDM", "<filename readonly=""yes"">"& "C:\Program Files (x86)\National Instruments\DIAdem 2012\Examples\Data\Example_data.tdm" & "</filename>") Set oMyProperties = oMyDataStore.RootElements(1).Properties For Each MyProperty in oMyProperties Call MsgBoxDisp("Property name: " & MyProperty.Name & vbCrLf & "Property value: " & MyProperty.Value) Next
Why can I not access this particular default property?
Solved! Go to Solution.
06-02-2014 06:16 AM
Hi Phex,
for date/time properties an object called UsiTimeDisp is returned. This object allows you extended service functionality like accessing each part (day, year, hour, seconds, ...) of your date/time value separately. If you want to print the date/time value with MessageBoxDisp you can use the VariantDate property of this object.
Your code could look like this then:
Dim oMyDataStore, MyProperty, oMyProperties Set oMyDataStore = Navigator.ConnectDataStoreByParameter("TDM", "<filename readonly=""yes"">"& "C:\Program Files (x86)\National Instruments\DIAdem 2012\Examples\Data\Example_data.tdm" & "</filename>") Set oMyProperties = oMyDataStore.RootElements(1).Properties For Each MyProperty in oMyProperties If MyProperty.DataType = eTime Then Call MsgBoxDisp("Property name: " & MyProperty.Name & vbCrLf & "Property value: " & MyProperty.Value.VariantDate) Else Call MsgBoxDisp("Property name: " & MyProperty.Name & vbCrLf & "Property value: " & MyProperty.Value) End If Next
I hope this helps.
Have a nice day,
Eva
06-02-2014 06:38 AM
Hi Eva,
thanks for your help, appreciated.
/Phex