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

Refer to Another Database

Status
Not open for further replies.

DougAtAvalon

Programmer
Jan 29, 2001
99
US
How do I Refer to another database record. Would I use SQL? what is the syntax if I know the path and name of db, the table name, and I guess the record wor\uld be criteria?

-Doug
 
You need to dimension and set references to the other db. method and syntax are the SAME as refering to current db, argument for the db needs to be the whole entire complete path filename (incl ".MDB"). There after, the objects (tables and queries) appear and operate the same as local objects. This is the "classic" for splitting a db into front/back end, so look at references for this for additional help.

MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
This is my code and vNetWorkPath is a full path with ".mdb"

***************
Public Function GetSecurityOnOff(vNetworkPath)
GetSecurityOnOff = "On"
Dim vSecurityValue
Dim dbs As Object
Dim vRecordset As Object

Set dbs = vNetworkPath

SQLstring = "SELECT DefaultSettings.*, DefaultSettings.DefaultID FROM DefaultSettings WHERE DefaultID = 'SecurityOn'"

Set vRecordset = dbs.OpenRecordset(SQLstring)
With vRecordset
vSecurityValue = ![DefaultValue]
End With

Set vRecordset = Nothing
Set dbs = Nothing
End Function
******************


I get a "Object does not support this property or method" error. I guess cause it's seeing "networkpath".Openrecordset(SQLString) which isn't correct

-Doug ?
 
Dim dbs As Object <== Should be database
MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top