I am getting to annoyed at the fact that I dont understand this! Maybe I been working on coding to much but that doesnt stop the fact that I have a deadline.
If you can I would really like some direct help, here is my code maybe you can find whats wrong. Its all the code commented and some of it is not going to be in the final if the DDE functions work. Most of it is of couse still being played with but if you have any comments please let me know, thank you for your time.
Private Declare Function GMW_LoadBDE Lib "gm6S32.dll" (ByVal sSysDir As String, ByVal sGoldDir As String, ByVal sCommonDir As String, ByVal sUser As String, ByVal sPassword As String) As Long
Private Declare Function GMW_UnloadBDE Lib "gm6S32.dll" () As Long
Private Declare Function GMW_NV_Create Lib "gm6S32.dll" () As Long
Private Declare Function GMW_NV_Delete Lib "gm6S32.dll" (ByVal hgmnv As Long) As Long
Private Declare Function GMW_Execute Lib "gm6S32.dll" (ByVal szFunc As String, ByVal GMPtr As Any) As Long
Private Declare Function GMW_NV_SetValue Lib "gm6S32.dll" (ByVal hgmnv As Long, ByVal name As String, ByVal Value As String) As Long
Private Declare Function GMW_NV_GetNameFromIndex Lib "gm6S32.dll" (ByVal hgmnv As Long, ByVal index As Long) As Long
Private Declare Function GMW_SetSQLUserPass Lib "gm6S32.dll" (ByVal sUserName As String, ByVal sPassword As String) As Long
Private Declare Function GMW_DB_Open Lib "gm6S32.dll" (ByVal sTableName As String) As Long
Private Declare Function GMW_DB_Close Lib "gm6S32.dll" (ByVal lArea As Long) As Long
Private Declare Function GMW_DB_Replace Lib "gm6S32.dll" (ByVal lArea As Long, ByVal sField As String, ByVal sData As String, ByVal iAddTo As Long) As Long
Private Declare Function GMW_DB_IsSQL Lib "gm6S32.dll" (ByVal lArea As Long) As Long
Private Declare Function GMW_DB_Goto Lib "gm6S32.dll" (ByVal lArea As Long, ByVal szRecNo As String) As Long
Private Sub Form_Load()
Dim lResult As Long
Dim NumValue As Long
Dim lGMPtr As Long
Dim lHandle
Dim lHandle2
Dim sRecId As String
Dim sRecId2 As String
Dim lDDE As Long
Dim UserName As String
Dim Password As String
Dim dbLocation As String
Dim SqlUser As String
Dim SqlPass As String
Dim CommonDir As String
Dim SysDir As String
Dim GoldDir As String
Dim sLogin As String
Dim ud1
Dim ud2
Dim ud3
Dim ud4
Dim ud5
Dim ud6
Dim Finished As Integer
Dim sCountact
Dim sAddress1
Dim sCity
Dim sState
Dim sZip
Dim sPhone1
Dim SQL_Database As Boolean
Finished = 1
With frmDDE
lDDE = .DDEInitiate
If lDDE > 0 Then
SysDir = .DDERequest("&SysDir"

GoldDir = .DDERequest("&GoldDir"

CommonDir = .DDERequest("&CommonDir"

sLogin = .DDERequest("[GetLoginCredentials]"

sRecId = .DDERequest("Contact1->RecId"

sRecId2 = .DDERequest("Contact1->RecId"
If lDDE = 0 Then
MsgBox ("DDE Channel couldnt be opened"

Unload Me
End If
Else
Unload Me
End If
End With
Me.Visible = False
On Error Resume Next
Open App.Path & "\GM_config.txt" For Input As #1
Input #1, dbLocation
Input #1, dbGMBase
Input #1, UserName
Input #1, Password
Input #1, SqlUser
Input #1, SqlPass
Close #1
'MsgBox "lResult = GMW_LoadBDE(" & GoldDir & "," & dbLocation & "," & dbLocation & "," & "MASTER" & "," & "ACCESS" & "

"
'"MSSQL: GMSM_Contacts: dbo:"
lResult = GMW_SetSQLUserPass(SqlUser, SqlPass)
'MsgBox "lResult = GMW_LoadBDE(" & GoldDir &CommonDir "," & dbLocation & "," & dbLocation & "," & "MASTER" & "," & "ACCESS" & "

"
'"MSSQL: GMSM_Contacts: dbo:"
lResult = GMW_LoadBDE(SysDir, GoldDir, CommonDir, UserName, Password)
Select Case lResult
Case 0:
MsgBox "BDE already loaded. " + lResult
Case -1:
MsgBox "BDE failed to loaded. " + lResult
Case -2:
MsgBox "Cannot find license file. " + lResult
Case -3:
MsgBox "Cannot load license file. " + lResult
Case -4:
MsgBox "Cannot validate the license file. " + lResult
Case -5:
MsgBox "Invalid GoldMine Dir. " + lResult
Case -6:
MsgBox "Invalid Common Dir. " + lResult
Case -7:
MsgBox "Failed to allocate the needed TLS slot. " + lResult
Case -8:
MsgBox "General Failure. " + lResult
Case -9:
MsgBox "No access to the specified contact set for this user. " + lResult
Unload Me
End Select
Dim RECID 'debug stuff
Dim SQ 'debug stuff
SQ = Chr(34)
MsgBox sRecId 'debug stuff
Do While Finished <> 0
With frmDDE
lDDE = .DDEInitiate
'Get the current information about the selected Contact window
If lDDE > 0 Then
sRecId2 = .DDERequest("Contact1->RecId"

sContact = .DDERequest("&Contact"

sAddress1 = .DDERequest("&Address1"

sCity = .DDERequest("&City"

sState = .DDERequest("&State"

sZip = .DDERequest("&ZIP"

sPhone = .DDERequest("&Phone"
If lDDE = 0 Then
MsgBox ("DDE Channel couldnt be opened"

Unload Me
End If
Else
Unload Me
End If
End With
'See if the contact window has changed.
If sRecId <> sRecId2 Then
With frmDDE
lHandle2 = .DDERequest("[Open(Contact2)]"

lResult = .DDERequest("[IsSQL(" + lHandle2 + "

]"

If lResult = 0 Then
SQL_Database = False
Else
SQL_Database = True
End If
'' Important ------ This here is where I am having problems, I dont understant what to put in the
'3rd param(where the 16 is) I just took that from the guide ( I have one for
'version 6.0 which is just an updated version from whats on your site.
'I want to compare contact2 table with the RecId field
'This is returning a 0(means it failed)
lResult = .DDERequest("[Move(" + lHandle2 + ", SetOrder, 16)]"
lResult = .DDERequest("[Move(" + lHandle2 + ", TOP)]"

If lResult <> 1 Then
MsgBox "Moved to the top"
End If
RECID = .DDERequest("[RECNO(" + lHandle2 + "

]"

'debug information
MsgBox RECID 'debug information
MsgBox sRecId 'debug information
'This is testing but I am sure you will yell about this.
lResult = .DDERequest("[Move(" + lHandle2 + ", Goto, "" + sRecId+ ""

]"

If lResult <> 1 Then
MsgBox "Failed to move"
End If
RECID = .DDERequest("[RECNO(" + lHandle2 + "

]"

'debug information
MsgBox RECID 'debug information
'This seems to work, even if its not at the right row
lResult = .DDERequest("[Replace(" + lHandle2 + ", " + SQ(34) + USERDEF01 + SQ(34) + ", sContact, 0)]"

If lResult = 1 Then
MsgBox "Passed replace"
Else
MsgBox "Failed replace"
End If
End With
' Open contact2 table
'lHandle2 = GMW_DB_Open("Contact2"

'If lHandle2 = 0 Then
'MsgBox ("Failed to open database."

' Unload Me
'End If
'check to see if we are in sql or xbase
'lResult = GMW_DB_IsSQL(lHandle2)
'If lResult = 0 Then
' MsgBox ("Opened non-sql file, closing."

' SQL_Database = False
'End If
'SQL_Database = True
'lGMPtr = GMW_NV_Create()
'move the current record to the one being viewed in sql
'lResult = GMW_DB_Goto(lHandle2, sRecId)
'Select Case lResult
' Case 0:
' MsgBox ("Error occurred"

'End Select
'Replace the value in UserDef these should not be hardcoded with our number value Constituent
'Important '----------------------------- Ignore this, GMW_DB_Replace() section
lResult = GMW_DB_Replace(lHandle2, "USERDEF01", sContact, 0)
If lResult = 0 Then
MsgBox ("Error occurred, no field has been changed."

End If
lResult = GMW_DB_Replace(lHandle2, "USERDEF02", sAddress1, 0)
If lResult = 0 Then
MsgBox ("Error occurred, no field has been changed."

End If
lResult = GMW_DB_Replace(lHandle2, "USERDEF03", sCity, 0)
If lResult = 0 Then
MsgBox ("Error occurred, no field has been changed."

End If
lResult = GMW_DB_Replace(lHandle2, "USERDEF04", sState, 0)
If lResult = 0 Then
MsgBox ("Error occurred, no field has been changed."

End If
lResult = GMW_DB_Replace(lHandle2, "USERDEF05", sZip, 0)
If lResult = 0 Then
MsgBox ("Error occurred, no field has been changed."

End If
lResult = GMW_DB_Replace(lHandle2, "USERDEF06", sPhone1, 0)
If lResult = 0 Then
MsgBox ("Error occurred, no field has been changed."

End If
Finished = 0
End If
Loop
'///////////////////////////////////////////////////////////////////////////////////////////
'move the current record to the one being viewed in sql
'lResult = GMW_DB_Goto(lHandle2, sRecId)
'Select Case lResult
' Case 0:
' MsgBox ("Error occurred"

'End Select
With frmDDE
'lResult = .DDERequest("[Move(" + lHandle2 + ", SetOrder, 2)]"

'lResult = .DDERequest("[Move(" + lHandle2 + ", Seek, " + sRecId + "

]"

'lResult = .DDERequest("[Read(" + lHandle2 + ", Contact)]"

lResult = .DDERequest("[Close(" + Handle2 + "

}"

'lResult = .DDERequest("[RecordObj(Refresh)]"

If lResult = 0 Then
MsgBox ("Failed to close the connection."

End If
End With
MsgBox "done"
'lResult = GMW_DB_Close(lHandle2)
'If lResult = 0 Then
' MsgBox ("Failed to close connection with sql."

'End If
'With frmDDE
'lResult = .DDERequest("[RecordObj(CloseWindow)]"

'lResult = .DDERequest("[RecordObj(Refresh)]"

'lResult = .DDERequest("[Move(" + lHandle2 + ", Goto, 10)]"

'lResult = .DDERequest("[Read(" + lHandle2 + ", Contact)]"
'If lResult = 0 Then
' MsgBox ("Failed to refresh."

'End If
'End With
'GMW_NV_Delete (lGMPtr)
lResult = GMW_UnloadBDE
If lResult = 0 Then
MsgBox ("Failed to close database"

End If
Unload Me
End Sub
Private Sub Form_Terminate()
frmDDE.Visible = False
Unload frmDDE
End Sub
Private Sub Form_Unload(Cancel As Integer)
frmDDE.Visible = False
Unload frmDDE
End Sub