Function CreateIndexesDAO()
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim ind As DAO.Index
'Initialize
Set db = CurrentDb()
Set tdf = db.TableDefs("tblDaoContractor")
'1. Primary key index.
Set ind = tdf.CreateIndex("PrimaryKey")
With ind
.Fields.Append .CreateField("ContractorID")
.Unique = False
.Primary = True
End With
tdf.Indexes.Append ind
'2. Single-field index.
Set ind = tdf.CreateIndex("Inactive")
ind.Fields.Append ind.CreateField("Inactive")
tdf.Indexes.Append ind
'3. Multi-field index.
Set ind = tdf.CreateIndex("FullName")
With ind
.Fields.Append .CreateField("Surname")
.Fields.Append .CreateField("FirstName")
End With
tdf.Indexes.Append ind
'Refresh the display of this collection.
tdf.Indexes.Refresh
'Clean up
Set ind = Nothing
Set tdf = Nothing
Set db = Nothing
Debug.Print "tblDaoContractor indexes created."
End Function
Private Function ImportRawProcessedToFinalDestination_1()
Dim rsimportRecon1RawProcessed As DAO.Recordset
Set rsimportRecon1RawProcessed = CurrentDb.OpenRecordset("importRecon1RawProcessed", dbOpenDynaset)
Dim rsdataAWF As DAO.Recordset
Set rsdataAWF = CurrentDb.OpenRecordset("dataAWF ", dbOpenDynaset)
'loop through source table
rsimportRecon1RawProcessed.MoveFirst
Do Until rsimportRecon1RawProcessed.EOF
'find record in destination table
rsdataAWF.FindFirst "ATMLocation = '" & rsimportRecon1RawProcessed![ATMLocation] & "' AND " & _
"TransactionDate= #" & Format(rsimportRecon1RawProcessed![TransactionDate], "m-d-yy") & "# AND " & _
"Amount= " & rsimportRecon1RawProcessed![Amount] & " AND " & _
"CreditDebit= '" & rsimportRecon1RawProcessed![CreditDebit] & "'"
'add / edit record
If rsdataAWF.NoMatch Then
rsdataAWF.AddNew
Else
rsdataAWF.Edit
End If
'field to add / edit
rsdataAWF![ATMLocation] = rsimportRecon1RawProcessed![ATMLocation]
rsdataAWF![TransactionDate] = rsimportRecon1RawProcessed![TransactionDate]
rsdataAWF![Amount] = rsimportRecon1RawProcessed![Amount]
rsdataAWF![CreditDebit] = rsimportRecon1RawProcessed![CreditDebit]
rsimportRecon1RawProcessed.MoveNext
Loop
CurrentDb.Execute "DELETE importRecon" & ReconFactorySetupNumber & "RawImported.* FROM importRecon" & ReconFactorySetupNumber & "RawImported;"
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "importRecon" & ReconFactorySetupNumber & "RawImported", PathOfSourceFileProcessed, True
End Function
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Most Valuable Expert award recognizes technology experts who passionately share their knowledge with the community, demonstrate the core values of this platform, and go the extra mile in all aspects of their contributions. This award is based off of nominations by EE users and experts. Multiple MVEs may be awarded each year.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.