rechrist87
Member
Hi.
I am trying to log a large data table into a 2 dimensional array from Control logix. I have been able to successfully load single dimension arrays for both read/write but I will get a #Ref fault when reading the 2-dimension. Below is my sample code for the VB script.
I am trying to log a large data table into a 2 dimensional array from Control logix. I have been able to successfully load single dimension arrays for both read/write but I will get a #Ref fault when reading the 2-dimension. Below is my sample code for the VB script.
Code:
Private Sub CommandButton1_Click()
rslinx = OpenRSLinx()
'Loop through reading the CLX array tags and put the values into the cells
For i = 0 To 73
For a = 0 To 73
Data1 = DDERequest(rslinx, "Allergen_CodeTable[" & i & " , " & a & "],L1,C1")
'iF THERE IS AN ERROR, DISPLAY A MESSAGE BOX
If TypeName(realData) = "Error" Then
If MsgBox("Error reading tag Allergen_CodeTable[" & i & " , " & a & "]. " & _
"Continue with Read?", vbYesNo + vbExclamation, _
"Error") = vbNo Then Exit For
Else
'No error, place data in cell
DDEPoke rslinx, "Allergen_CodeTable[" & i & " , " & a & "]", Cells(3 + i, 3 + a)
End If
Next a
Next i
'Terminate RSLinx
DDETerminate rslinx
End Sub