I come again to the well of knowledge...
Access 2016, Azure SQL instance.
My application maintains a local table of "AllClients" which is a subset of my AllPeople table. At app startup, the sub that drops AllClients then creates a new AllClients table works fine. Then, later on, the same sub fails with Run Time code 438 (Object doesdn't support this property or method) when attempting to drop the table.
As noted in the code below, I tried emptying out AllClients and executing a query to refill it. This also fails.
Notes: Azure SQL does not play nice with Access. Sometimes the queries work, sometimes not. I use brief delays after each SQL query to allow the command to complete (don't laugh, it works). I probably should make this a stored procedure.
Regards,
Ken
Access 2016, Azure SQL instance.
My application maintains a local table of "AllClients" which is a subset of my AllPeople table. At app startup, the sub that drops AllClients then creates a new AllClients table works fine. Then, later on, the same sub fails with Run Time code 438 (Object doesdn't support this property or method) when attempting to drop the table.
As noted in the code below, I tried emptying out AllClients and executing a query to refill it. This also fails.
Code:
Public Sub BuildAllClients(Initial As Boolean) ' Update AllClients. This is a temporary table.
On Error GoTo ShowMeError
Dim ClientCount As Integer
SysCmdResult = SysCmd(4, "Building AllClients table. ")
Call BriefDelay
If IsObjectOpen("AllClients", acTable) Then DoCmd.Close acTable, "AllClients"
' If IsTableQuery("AllClients") Then TILLDataBase.Execute "DROP TABLE AllClients", dbSeeChanges
If IsTableQuery("AllClients") Then CurrentProject.Connection.Execute "DROP TABLE AllClients", dbSeeChanges
' TILLDataBase.Execute "DELETE * FROM AllClients", dbSeeChanges: Call BriefDelay
Call BriefDelay
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryBuildAllClients"
DoCmd.SetWarnings True
' TILLDataBase.Execute "INSERT INTO AllClients ( DisplayName, ReverseDisplayName, IndexedName, LastName, FirstName, MiddleInitial, IsClientDay, IsClientRes, IsClientTrans, IsClientVocat, IsCilentCLO, IsClientIndiv, IsClientAutism, IsClientPCA, IsClientIHBC, IsClientSpring, IsClientTRASE, IsClientSTRATTUS, IsClientCommunityConnections) " & _
' "SELECT [tblPeople]![FirstName] & ' ' & [tblPeople]![MiddleInitial] & ' ' & [tblPeople]![LastName] AS DisplayName, [tblPeople].[LastName] & ', ' & [tblPeople].[Firstname] AS ReverseDisplayName, tblPeople.IndexedName, tblPeople.LastName, tblPeople.FirstName, tblPeople.MiddleInitial, tblPeople.IsClientDay, tblPeople.IsClientRes, tblPeople.IsClientTrans, tblPeople.IsClientVocat, tblPeople.IsCilentCLO, tblPeople.IsClientIndiv, tblPeople.IsClientAutism, tblPeople.IsClientPCA, tblPeople.IsClientIHBC, tblPeople.IsClientSpring, tblPeople.IsClientTRASE, tblPeople.IsClientSTRATTUS, tblPeople.IsClientCommunityConnections FROM tblPeople " & _
' "WHERE tblPeople.ClientCompletelyInactive=False AND tblPeople.IsDeceased=False AND tblPeople.IsClient=True " & _
' "ORDER BY [tblPeople].[LastName] & ', ' & [tblPeople].[Firstname];", dbSeeChanges: Call BriefDelay
Call BriefDelay(2)
If Initial Then
ClientCount = DCount("DisplayName", "AllClients")
Call ProgressMessages("Append", " " & ClientCount & " total active clients identified.")
End If
Exit Sub
ShowMeError:
Err.Source = "PublicSubroutines" & "(Line #" & Str(Err.Erl) & ")": TILLDBErrorMessage = "Error # " & Str(Err.Number) & " was generated by " & Err.Source & Chr(13) & Err.Description
MsgBox TILLDBErrorMessage, vbOKOnly, "Error", Err.HelpFile, Err.HelpContext
End Sub
Notes: Azure SQL does not play nice with Access. Sometimes the queries work, sometimes not. I use brief delays after each SQL query to allow the command to complete (don't laugh, it works). I probably should make this a stored procedure.
Regards,
Ken