I'm trying to write a function that is past a command as a string which it then sends to MS Access using a DDE conversation.
When I run the code it sticks at the "linkMode = 1" line and complains that "Foreign aplication wont perform DDE method or operation".
Heres the code (you can ignore most of it cos everything works apart from the DDE stuff):
Public Function OpenDatabase(Database, Control As String, Field As Integer) As String
Dim Chan As Double
Dim Temp
ID = GetLink(Field)
Chan = Shell("c:\program files\microsoft office\office\msaccess.exe g:\highways\highwaysdbs\" + Database + ".mdb", 1)
If Chan = 0 Then
OpenDatabase = "Failed to open Access"
Else
OpenDatabase = Database + " opening at: " + ID
End If
PublicHW.FieldData.LinkMode = 0
PublicHW.FieldData.LinkTopic = "MSAccess|System"
PublicHW.FieldData.LinkMode = 1
Debug.Print Control
PublicHW.FieldData.LinkExecute Control
End Function
Any help would be much appreciated!
Sorry to have to post code but I'm new to VB.
elziko
When I run the code it sticks at the "linkMode = 1" line and complains that "Foreign aplication wont perform DDE method or operation".
Heres the code (you can ignore most of it cos everything works apart from the DDE stuff):
Public Function OpenDatabase(Database, Control As String, Field As Integer) As String
Dim Chan As Double
Dim Temp
ID = GetLink(Field)
Chan = Shell("c:\program files\microsoft office\office\msaccess.exe g:\highways\highwaysdbs\" + Database + ".mdb", 1)
If Chan = 0 Then
OpenDatabase = "Failed to open Access"
Else
OpenDatabase = Database + " opening at: " + ID
End If
PublicHW.FieldData.LinkMode = 0
PublicHW.FieldData.LinkTopic = "MSAccess|System"
PublicHW.FieldData.LinkMode = 1
Debug.Print Control
PublicHW.FieldData.LinkExecute Control
End Function
Any help would be much appreciated!
Sorry to have to post code but I'm new to VB.
elziko