[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sending a Global Variable from MS-Access-97 to a very simple system is failing.



PureBytes Links

Trading Reference Links

Hi,

I am doing a simple test using Global Variables 2.2 which is failing.
Maybe someone knows the trick to this and could help.
I list what works then what fails below.
Then I show the simple bare bones code.

This works:
I can set the value inside the simple system with GV_SetInteger.
I can get the value back inside the simple system with GV_GetInteger
(see below)

This works:
I can set the value inside MS-Access with GV_SetInteger.
I can get the value back inside MS-Access with GV_GetInteger
(see below)

This fails:
I am trying to set an integer inside MS-Access-97
then bring that value into a simple test system.
It gives me the message
Trying access at data to future. Bars Reference value : -65516
The log file (see below) shows that the value coming in is -65516

Of note, the path to the DLL is correct since the internal tests work.
The paths are exactly the same in the system and in MS-Access.
Of note, I try "byRef" in MS-Access and it fails inside MS-Access.

Thanks,
John.

=======================================================
Part of the Simple system
=======================================================
variables:
   SetGetValue(0);

if CurrentBar = 1 then
   Begin
DefineDLLFunc: "C:\ProperPath\GlobalVariable.dll", int, "GV_GetInteger", int ; DefineDLLFunc: " C:\ProperPath\GlobalVariable.dll ", int, "GV_SetInteger", int, int ;
    {value1 = GV_SetInteger( 1, 5 ) ;} {Internal test commented out}
    SetGetValue = GV_GetInteger( 1 ) ;
    Print (File("C:\Access\ALog55.txt"), SetGetValue);
   end;


=======================================================
MS-Access Code
=======================================================

Private Declare Function GV_GetInteger Lib "C:\ProperPath\GlobalVariable.dll" _ (ByVal intElementLoc As Integer) As Integer Private Declare Function GV_SetInteger Lib "C:\ProperPath\GlobalVariable.dll" _ (ByVal intElementLoc As Integer, ByVal intSetValue As Integer) As Integer

Private intStatus As Integer


Private Sub fldBV_Upper_AfterUpdate()
    Call funcGetIntegerWorks2
End Sub


Private Function funcGetIntegerWorks2()
   Dim SetGetValue As Integer:   SetGetValue = Me.fldBV_Upper
Dim intEleLoc As Long : intEleLoc = 1 'I tried integer here but it fails internally within MS-Access. 'I tried hard coding a 1 in the GV_SetInteger call but the result is the same

   intStatus = GV_SetInteger(intEleLoc, SetGetValue)
   If intStatus = -1 Then
       MsgBox "GV_SetInteger failed with status = " & intStatus
   End If
   MsgBox "GV_GetInteger returned this value " & GV_GetInteger(intEleLoc)
End Function