Support
Quality
Security
License
Reuse
kandi has reviewed GTAS and discovered the below as its top functions. This is intended to give you an instant insight into GTAS implemented functionality, and help decide if they suit your requirements.
API and PNR Data Processing
Criteria Based Risk Assessment
Watch List Based Risk Assessment
Identification of partial Watch List matches
Risk Criteria Management Interface
Watch List Management Interface
View Flights and Passengers Interface
Query Flights and Passengers Interface
Cloud-Ready
Case Management for Decision Support
Free-Text Search
Customizable Dashboard
Graph Database (Neo4J)
Graph Database Rules Engine for Identifying Risk Patterns
VBA loop that will read from different tables
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Set db = CurrentDb
For Each tdf In db.TableDefs
' ignore system and temporary tables
If Not (tdf.Name Like "MSys*" Or tdf.Name Like "~*") Then
Dim sTable As String
sTable = tdf.Name
Dim strSQL
strSQL = "INSERT INTO Tbl_GTAS ( SF133_Rpt_Line, LineDescription, LineAmt, TS)" & _
"SELECT T.F1, T.F2,T.F3, '" & Replace(sTable, "_NEW SF 133", "") & "' AS TS " & _
"FROM " & sTable & " AS T" & _
"GROUP BY T.F1, T.F2, T.F3,'" & Replace(sTable, "_NEW SF 133", "") & "';"
'do what you will with SQL
End If
Next
QUESTION
VBA loop that will read from different tables
Asked 2017-Jan-30 at 20:25I need to write a VBA that will loop through 128 different tables that are linked into my access database from 128 different excel files and take the data and place it into one table. Each table is the same just a different TS. I was able to write this:
strSQL = "INSERT INTO Tbl_GTAS ( SF133_Rpt_Line, LineDescription, LineAmt,
TS ) SELECT [75-XXXX-XXXX_NEW SF 133].F1, [75-XXXX-XXXX_NEW SF 133].F2,
[75-XXXX-XXXX_NEW SF 133].F3, '75-XXXX-XXXX' AS TS FROM [75-XXXX-XXXX_NEW SF 133]
GROUP BY [75-XXXX-XXXX_NEW SF 133].F1, [75-XXXX-XXXX_NEW SF 133].F2,
[75-XXXX-XXXX_NEW SF 133].F3, '75-XXXX-XXXX';"
I just need to take that somehow and have it pull for each of my tables.
All of my tables have the same naming convention with either XX, XXXX or X after the 75-. Any help would be very appreciated!!
Thanks!
edit:
Full VBA code:
Public Function GTAS()
Dim SBRLink2017 As DAO.Database
Set SBRLink2017 = CurrentDb
Dim delSQL As String
Dim updSQL As String
Dim str1SQL As String
DoCmd.SetWarnings False
delSQL = "DELETE tbl_GTAS.* FROM tbl_GTAS';"
DoCmd.RunSQL (delSQL)
str1SQL = "INSERT INTO Tbl_GTAS ( SF133_Rpt_Line, LineDescription, LineAmt, TS ) SELECT [75-XXXX-XXXX_NEW SF 133].F1, [75-XXXX-XXXX_NEW SF 133].F2, [75-XXXX-XXXX_NEW SF 133].F3, '75-XXXX-XXXX' AS TS FROM [75-XXXX-XXXX_NEW SF 133] GROUP BY [75-XXXX-XXXX_NEW SF 133].F1, [75-XXXX-XXXX_NEW SF 133].F2, [75-XXXX-XXXX_NEW SF 133].F3, '75-XXXX-XXXX';"
DoCmd.RunSQL str1SQL
updSQL = "UPDATE Tbl_GTAS SET Tbl_GTAS.TS_SF133_Rpt_Line = [TS] & '_' & [SF133_Rpt_Line];"
DoCmd.RunSQL (updSQL)
DoCmd.SetWarnings True
End Function
ANSWER
Answered 2017-Jan-30 at 20:03Untested and double-check that I included all parenthesis as needed. I think I did:
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Set db = CurrentDb
For Each tdf In db.TableDefs
' ignore system and temporary tables
If Not (tdf.Name Like "MSys*" Or tdf.Name Like "~*") Then
Dim sTable As String
sTable = tdf.Name
Dim strSQL
strSQL = "INSERT INTO Tbl_GTAS ( SF133_Rpt_Line, LineDescription, LineAmt, TS)" & _
"SELECT T.F1, T.F2,T.F3, '" & Replace(sTable, "_NEW SF 133", "") & "' AS TS " & _
"FROM " & sTable & " AS T" & _
"GROUP BY T.F1, T.F2, T.F3,'" & Replace(sTable, "_NEW SF 133", "") & "';"
'do what you will with SQL
End If
Next
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
No vulnerabilities reported
Save this library and start creating your kit
Save this library and start creating your kit