M
MyMel
Hi,
I have a Invoice table that is imported into Access from Oracle
that has multiple entries for the same invoices. Everytime an
adjustment is made to the invoice in Oracle a new record is
created. What I am trying to do is to move only the most current
invoice row to another table using fields call "Record Complete
Date" and Invoice#.
This is my code and I'm not getting anywhere with it. Would
someone please offer some guidance please.
Function DIRTRoll()
Dim StoreInvoice As String
Dim StoreDate As Date
Dim intCntr As Integer
DoCmd.ShowAllRecords
DoCmd.GoToControl ("Invoice#")
Set db = CurrentDb()
Set ToTable = db.OpenRecordset("DIRT_Table")
Set FromTable = db.OpenRecordset("DIRT_ImportTable")
StoreInvoice = FromTable![Invoice#]
StoreDate = FromTable![Record Completion Date]
FromTable.MoveFirst
'ToTable.MoveLast
'FromTable.MoveLast
If FromTable.EOF = False Then StoreDate = FromTable![Record
Completion Date]
Do Until FromTable.EOF
If StoreInvoice = FromTable![Invoice#] Then
If StoreDate <= FromTable![Record Completion Date] Then
FromTable.MoveNext
Else
If StoreDate > FromTable![Record Completion Date]
Then
'CopyRecord(,"DIRT_Table",,,,,)
End If
End If
Else
End If
FromTable![Invoice#].SetFocus
FromTable.MoveNext
Loop
ToTable.Close
FromTable.Close
End Function
Thank you,
Melody
I have a Invoice table that is imported into Access from Oracle
that has multiple entries for the same invoices. Everytime an
adjustment is made to the invoice in Oracle a new record is
created. What I am trying to do is to move only the most current
invoice row to another table using fields call "Record Complete
Date" and Invoice#.
This is my code and I'm not getting anywhere with it. Would
someone please offer some guidance please.
Function DIRTRoll()
Dim StoreInvoice As String
Dim StoreDate As Date
Dim intCntr As Integer
DoCmd.ShowAllRecords
DoCmd.GoToControl ("Invoice#")
Set db = CurrentDb()
Set ToTable = db.OpenRecordset("DIRT_Table")
Set FromTable = db.OpenRecordset("DIRT_ImportTable")
StoreInvoice = FromTable![Invoice#]
StoreDate = FromTable![Record Completion Date]
FromTable.MoveFirst
'ToTable.MoveLast
'FromTable.MoveLast
If FromTable.EOF = False Then StoreDate = FromTable![Record
Completion Date]
Do Until FromTable.EOF
If StoreInvoice = FromTable![Invoice#] Then
If StoreDate <= FromTable![Record Completion Date] Then
FromTable.MoveNext
Else
If StoreDate > FromTable![Record Completion Date]
Then
'CopyRecord(,"DIRT_Table",,,,,)
End If
End If
Else
End If
FromTable![Invoice#].SetFocus
FromTable.MoveNext
Loop
ToTable.Close
FromTable.Close
End Function
Thank you,
Melody