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

RecordSource

Status
Not open for further replies.

NNNNN

MIS
Joined
Dec 2, 2002
Messages
90
Location
GB
I have 2 databases BD1 and DB2

I open DB1 and Try to return the results from querying DB2

I can message out the data which shows that the query works in so far as it is in memory
the problem is I want to display the records on a form but this is proving difficult

Please see below


Dim Dbs_Database As DAO.Database
dIM strSQL as String
Dim rst(1 To 3) As DAO.Recordset

Set Dbs_Database = OpenDatabase("C:\DB\MYDB.mdb")


strSQL = "Select * From tblOne;"
Set rst(1) = Dbs_Database.OpenRecordset(strSQL)

MsgBox (rst(1)![Persons Name]) OK message works
MsgBox (rst(1).Fields(0).Name) OK message works
(I can also loop through the records to meg out every record)



Me.RecordSource = strSQL 'Error the recordsource "Select * From tblOne" does not exist

Me.RecordSource = rst(1) 'Error "Type mismatch"

Can this be achieved?

Thanks
 
How about:
[tt]SELECT *
FROM tblOne IN 'C:\DB\MYDB.mdb'[/tt]

You may wish to consider ADO.
 
Like...

Me.RecordSource =
"SELECT * FROM tblOne IN 'C:\DB\MYDB.mdb'"

Gary
gwinn7
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top