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

pulling data from tables in other DBs using DDE

Status
Not open for further replies.

AArt

Technical User
Mar 14, 2001
102
US
I know I've done this a long time a go. I'm trying to join this century and not use DAO. I pulled this right from the help files. I'm looping through all of the DBs in the directory and pulling the database creation date in the MsysObjects file. The looping is successful, but it crashes at the DDEExecute call.
Thanks!

Function AccessDDE(fname As String) As String
Dim intChan1 As Integer, intChan2 As Integer, strSQL As String, strDB As String
Dim strQueryData As String
On Error GoTo error2:

strDB = "[OpenDatabase " & fname & "]" ' Also tried without the brackets

intChan1 = DDEInitiate("MSAccess", "System")


DDEExecute intChan1, strDB ' crashes here - error 6 Overflow

strSQL = "SELECT MSysObjects.DateCreate, MSysObjects.Name FROM MSysObjects WHERE (((MSysObjects.Name)= """
strSQL = strSQL & "Databases """
strSQL = strSQL & ");"

' haven't got to test this part'
intChan2 = DDEInitiate("MSAccess", fname & ";" & " TABLE MSysObjects")
strQueryData = DDERequest(intChan2, strSQL)
AccessDDE = strQueryData

DDETerminate intChan2

' Close database.
DDEExecute intChan1, "[CloseDatabase]"
DDETerminate intChan1

error2: Debug.Print Err.Number, Err.Description

End Function


 
DDE? Eeee
There's nothing wrong with DAO, it is still usually the best choice when dealing with Access database objects.

DDE is actually pretty "old school".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top