UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
2 Pages V < 1 2  (Go to first unread post)
   Reply to this topicStart new topic
> Delete All "*" & "temp" & "*" Tables, Access 2016    
 
   
MadPiet
post Oct 8 2019, 08:37 PM
Post#21



Posts: 3,331
Joined: 27-February 09



Knuckles,

One thing I would point out to them is that sharing a front end is a risky thing to do. If you dig around here, there are lots of horror stories about it. If you can wean them off that by creating a front end and distributing it, so everyone has a copy, then your life should get easier. Then if the users create tables in their individual front ends for reporting or whatever, no big deal. You could add some code to a hidden form that asks if the user wants to clean up his temporary tables or keep them...

Did anybody here ever use Tony Toews' Auto Front End Updater? (or do you just push it through Windows in the login event?)

Pieter
Go to the top of the page
 
WildBird
post Oct 8 2019, 09:21 PM
Post#22


UtterAccess VIP
Posts: 3,620
Joined: 19-August 03
From: Auckland, Little Australia


CODE
Function RemoveTempTables() As Boolean
'Date:          Wednesday, 09 October 2019 3:01:15 PM
'Author:        Stephen Cooper
'Email:         coopers@XXXXXXXXXXX.com
'Ph:
'In parameters
'Output
'Description:
'Calls:
'Notes:
'Example:

On Error GoTo HandleError:

RemoveTempTables = True

Dim intMouseType As Integer
Dim strErrorMsg As String
Dim varReturn As Variant
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim strTableName As String
Dim arrNames As Variant
Dim i As Integer
Dim strDelete As String

intMouseType = Screen.MousePointer

DoCmd.Hourglass True

Set db = CurrentDb

For Each tdf In db.TableDefs
    If InStr(1, tdf.Name, "tblTemp") > 0 Then
        strDelete = strDelete & tdf.Name & ";"
    End If
Next tdf

If Len(strDelete) > 1 And Right(strDelete, 1) = ";" Then
    strDelete = Left(strDelete, Len(strDelete) - 1)
End If

arrNames = Split(strDelete, ";")

For i = 0 To UBound(arrNames)
    strTableName = Trim(arrNames(i))
    db.TableDefs.Delete strTableName
Next i

ExitHere:
On Error Resume Next
'Close all recordsets etc here
db.TableDefs.Refresh
db.Close
Set db = Nothing
varReturn = SysCmd(acSysCmdClearStatus)
Screen.MousePointer = intMouseType
Exit Function

HandleError:
Select Case Err.Number
Case Else
    'LogError "RemoveTempTables|" & CurrentProject.Name & "|" & strErrorMsg & "|" & Err.Number & " - " & Err.Description & "| Line number " & Erl
    MsgBox strErrorMsg & " " & Err.Number & " " & Err.Description, vbInformation, "Error"
    RemoveTempTables = False
    'DoCmd.Close acForm, strUpdateForm, acSaveNo
    Resume ExitHere
End Select

End Function


Try this. Can call it by
if RemoveTempTables then
msgbox "Tables deleted"
end if'RemoveTempTables



--------------------
Beer, natures brain defragging tool.
Go to the top of the page
 
tina t
post Oct 9 2019, 01:29 PM
Post#23



Posts: 6,122
Joined: 11-November 10
From: SoCal, USA


QUOTE
Did anybody here ever use Tony Toews' Auto Front End Updater?

yes. i persuaded my IT manager to invest in a license some years ago, when use of my apps began to spread throughout the building and running around to all the PCs to install updated versions became problematic for me. we've happily used it ever since, and expect to continue to do so.

hth
tina

--------------------
"the wheel never stops turning"
Go to the top of the page
 
Knuckles
post Oct 10 2019, 05:47 AM
Post#24



Posts: 898
Joined: 1-February 10
From: New Jersey



I have also used Tony's updater in the past with much success. If I can convince them to address the issues I am planning on implementing it here.

Thanks again all for the suggestions.

K
Go to the top of the page
 
2 Pages V < 1 2


Custom Search


RSSSearch   Top   Lo-Fi    18th October 2019 - 04:12 PM