CreateView.vba 561 B

1234567891011121314151617
  1. 'https://stackoverflow.com/questions/32770318/attempting-create-view-in-access-gives-syntax-error-in-create-table-statement
  2. Public Function CreateView()
  3. Dim strSql As String
  4. strSql = "CREATE VIEW temp_view AS" & vbCrLf & _
  5. "SELECT" & vbCrLf & _
  6. " inventory2.[Unique ID] AS unique_id ," & vbCrLf & _
  7. " inventory2.[Used in Site] AS mv ," & vbCrLf & _
  8. " ExtraLoad.[Used in Site] AS csv" & vbCrLf & _
  9. "FROM inventory2 , ExtraLoad" & vbCrLf & _
  10. "WHERE inventory2.[Unique ID] = ExtraLoad.[Unique ID];"
  11. CurrentProject.Connection.Execute strSql
  12. End Function