When I use the GetFirst or GetNext or GetLast methods of the ActiveX Control, Status Code 22 is returned. These records do NOT have more than 60 fields they are quite small in fact.
I have dropped the control on a form and EVERYTHING else is done in the following code. Any help would be greatly appreciated.
Thanks
David Coulter
dcoulter@nchfa.com
Option Explicit
Sub Main()
GetPlatinum400NLTXD
End Sub
Sub GetPlatinum400NLTXD()
Dim objPlatinum400 As VAccess
Dim objConn As New ADODB.Connection
Dim objGLTRAN400 As New ADODB.Recordset
Dim intRows As Integer
Dim Stat As Integer
Set objPlatinum400 = frmPlatinum400.VAccess1
objConn.Open ("driver={Microsoft Access Driver (*.mdb)};dbq=\\nchfa1\sys\stbudget\statebud.mdb;uid=Admin"
objGLTRAN400.Open "SELECT * FROM [400 GLTRAN -JOURNAL TRN]", objConn
objPlatinum400.DdfPath = "p:\platinum\400\"
objPlatinum400.TableName = "NLTXD"
objPlatinum400.OpenMode = ReadOnly
Stat = objPlatinum400.Open
MsgBox "Stat: " & Stat
Stat = objPlatinum400.GetFirst
MsgBox "Stat: " & Stat
While Stat = 0
MsgBox "HostConnect: " & objPlatinum400.HostConnect
Stat = objPlatinum400.GetNext
Wend
'MsgBox objPlatinum400.Fields
'objPlatinum400.StepLast
'MsgBox objPlatinum400.Fields("Jrnlky"
'objPlatinum400.StepFirst
'MsgBox objPlatinum400.Fields("Jrnlky"
For intRows = 1 To objPlatinum400.Rows
objGLTRAN400.AddNew
objGLTRAN400.Fields("ACCT GEN ;GLTRAN" = objPlatinum400.FieldValue("ACCT GEN ;GLTRAN"
objGLTRAN400.Fields("ACCT SUB ;GLTRAN" = objPlatinum400.FieldValue("ACCT SUB ;GLTRAN"
objGLTRAN400.Fields("JOURNAL KEY ;GLTRAN" = objPlatinum400.FieldValue("JOURNAL KEY ;GLTRAN"
objGLTRAN400.Fields("DESCRIPTION ;GLTRAN" = objPlatinum400.FieldValue("DESCRIPTION ;GLTRAN"
objGLTRAN400.Fields("ENTRY DATE ;GLTRAN" = objPlatinum400.FieldValue("ENTRY DATE ;GLTRAN"
objGLTRAN400.Fields("APPLY DATE ;GLTRAN" = objPlatinum400.FieldValue("APPLY DATE ;GLTRAN"
objGLTRAN400.Fields("DOC NO ;GLTRAN" = objPlatinum400.FieldValue("DOC NO ;GLTRAN"
objGLTRAN400.Fields("SYSTEM ID ;GLTRAN" = objPlatinum400.FieldValue("SYSTEM ID ;GLTRAN"
objGLTRAN400.Fields("DEBIT AMT ;GLTRAN" = objPlatinum400.FieldValue("DEBIT AMT ;GLTRAN"
objGLTRAN400.Fields("CREDIT AMT ;GLTRAN" = objPlatinum400.FieldValue("CREDIT AMT ;GLTRAN"
objGLTRAN400.Update
Next
objPlatinum400.Close
objGLTRAN400.Close
Set objPlatinum400 = Nothing
Set objGLTRAN400 = Nothing
objConn.Close
Set objConn = Nothing
End Sub
I have dropped the control on a form and EVERYTHING else is done in the following code. Any help would be greatly appreciated.
Thanks
David Coulter
dcoulter@nchfa.com
Option Explicit
Sub Main()
GetPlatinum400NLTXD
End Sub
Sub GetPlatinum400NLTXD()
Dim objPlatinum400 As VAccess
Dim objConn As New ADODB.Connection
Dim objGLTRAN400 As New ADODB.Recordset
Dim intRows As Integer
Dim Stat As Integer
Set objPlatinum400 = frmPlatinum400.VAccess1
objConn.Open ("driver={Microsoft Access Driver (*.mdb)};dbq=\\nchfa1\sys\stbudget\statebud.mdb;uid=Admin"
objGLTRAN400.Open "SELECT * FROM [400 GLTRAN -JOURNAL TRN]", objConn
objPlatinum400.DdfPath = "p:\platinum\400\"
objPlatinum400.TableName = "NLTXD"
objPlatinum400.OpenMode = ReadOnly
Stat = objPlatinum400.Open
MsgBox "Stat: " & Stat
Stat = objPlatinum400.GetFirst
MsgBox "Stat: " & Stat
While Stat = 0
MsgBox "HostConnect: " & objPlatinum400.HostConnect
Stat = objPlatinum400.GetNext
Wend
'MsgBox objPlatinum400.Fields
'objPlatinum400.StepLast
'MsgBox objPlatinum400.Fields("Jrnlky"
'objPlatinum400.StepFirst
'MsgBox objPlatinum400.Fields("Jrnlky"
For intRows = 1 To objPlatinum400.Rows
objGLTRAN400.AddNew
objGLTRAN400.Fields("ACCT GEN ;GLTRAN" = objPlatinum400.FieldValue("ACCT GEN ;GLTRAN"
objGLTRAN400.Fields("ACCT SUB ;GLTRAN" = objPlatinum400.FieldValue("ACCT SUB ;GLTRAN"
objGLTRAN400.Fields("JOURNAL KEY ;GLTRAN" = objPlatinum400.FieldValue("JOURNAL KEY ;GLTRAN"
objGLTRAN400.Fields("DESCRIPTION ;GLTRAN" = objPlatinum400.FieldValue("DESCRIPTION ;GLTRAN"
objGLTRAN400.Fields("ENTRY DATE ;GLTRAN" = objPlatinum400.FieldValue("ENTRY DATE ;GLTRAN"
objGLTRAN400.Fields("APPLY DATE ;GLTRAN" = objPlatinum400.FieldValue("APPLY DATE ;GLTRAN"
objGLTRAN400.Fields("DOC NO ;GLTRAN" = objPlatinum400.FieldValue("DOC NO ;GLTRAN"
objGLTRAN400.Fields("SYSTEM ID ;GLTRAN" = objPlatinum400.FieldValue("SYSTEM ID ;GLTRAN"
objGLTRAN400.Fields("DEBIT AMT ;GLTRAN" = objPlatinum400.FieldValue("DEBIT AMT ;GLTRAN"
objGLTRAN400.Fields("CREDIT AMT ;GLTRAN" = objPlatinum400.FieldValue("CREDIT AMT ;GLTRAN"
objGLTRAN400.Update
Next
objPlatinum400.Close
objGLTRAN400.Close
Set objPlatinum400 = Nothing
Set objGLTRAN400 = Nothing
objConn.Close
Set objConn = Nothing
End Sub