Writing some VBA to call a make table query. It the make query is pulling data from a MS 2008 R2 SQL database then creating the data locally for processing. It works, but not when I call it out of the code below:
I get the error: Run time error '3065' Can not execute a select query. From what I read on line about a 3065 I should be able to run a make query, just not a "select"
Code:
Private Sub CopyData_Click()
Dim dbo_Machine_a As QueryDef
Dim dbo_Machine_Hello As QueryDef
Dim dbo_Machine_World As QueryDef
Select Case MachineNameCombo
Case "a"
DoCmd.SetWarnings False
DBEngine(0)(0).Execute "dbo_Machine_a"
DoCmd.SetWarnings True
Case "Hello"
DoCmd.SetWarnings False
DBEngine(0)(0).Execute "dbo_Machine_Hello"
DoCmd.SetWarnings True
Case "World"
DoCmd.SetWarnings False
DBEngine(0)(0).Execute "dbo_Machine_World"
DoCmd.SetWarnings True
End Select
End Sub
Comment