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

Custom Properties in another DB 1

Status
Not open for further replies.

srmclean

Technical User
Jun 23, 2003
23
0
0
AU
I have two .mdb files and when I link them in VB I want to check that a custom property (one I've created to keep track of table structures) matches. I've written a function in one .mdb to look up the custom property of the other .mdb but it's isn't working. I get the error that the property is not found even though I am 100% sure it's there...

Any ideas??


Function GetRemoteCustomProperty(RemoteDBFile As String, Property As String) As Variant
On Error GoTo Err_GetRemoteCustomProperty

Dim RemoteDB As Database

Set RemoteDB = DBEngine.Workspaces(0).OpenDatabase(RemoteDBFile)

RemoteDB.Containers!Databases.Documents!UserDefined.Properties.Refresh
GetRemoteCustomProperty = CurrentDb.Containers!Databases.Documents!UserDefined.Properties(Property)

Exit_GetRemoteCustomProperty:
Exit Function

Err_GetRemoteCustomProperty:
MsgBox Err.Description
Resume Exit_GetRemoteCustomProperty

End Function
 
Hi

An immediate thought or gues depending on your point of view, you are using a parameter Property, but Property is presumably an Access Reserved word, since there is a coplection called Properties with elements of Property. How about amending your code to use (say) strProperty

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Hi srmclean,

No conceptual problems. You're just looking in the wrong database. Change ..

[purple]
Code:
GetRemoteCustomProperty = CurrentDb.Containers!Databases.Documents!UserDefined.Properties(Property)
[/purple]

.. to ..

[blue]
Code:
GetRemoteCustomProperty =
[red]
Code:
RemoteDb
[/red]
Code:
.Containers!Databases.Documents!UserDefined.Properties(Property)
[/blue]


Enjoy,
Tony

------------------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading FAQ222-2244 before you ask a question.
 
a case of spot the deliberate mistake ..

thanks for pointing out my simple error, everything is working fine now.

Regards,

Shaun

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top