Use Temporary tables for quick analysis

PHOTO EMBED

Wed Nov 16 2022 09:06:10 GMT+0000 (Coordinated Universal Time)

Saved by @paulbarry

Private Sub TestTemp()
On Error GoTo ErrorHandler
Dim strSQL as String
Dim strTable as String
strTable = "tblTempTest"
'Delete the table if it exists
DoCmd.DeleteObject  acTable, strTable
strSQL = "Select * INTO " & strTable & " FROM tblCustomers " & _
"Where CustomerState = 'ILL'"
Currentdb.Execute strSQL
'Insert more code here to do something with temp table
Exit Sub
ErrorHandler:
IF Err.Number = 7874 Then
Resume Next 'Tried to delete a non-existing table, resume
End If
End Sub
content_copyCOPY

https://accessexperts.com/blog/2011/07/20/use-temp-tables-in-your-code-for-quick-and-easy-analysis/