Reputation: 517
I added the following code inside the tables file inside a module:
Public Function MyFun()
On Error Resume Next
Dim xCounter As Integer
xCounter = DLookup("xcounter", "tblfs1", "[xid] = 1")
xCounter = xCounter + 1
Dim xSql As String
xSql = "update tblfs1 set [xcounter] = " & xCounter & " where [xid] = 1"
CurrentDb.Execute xSql
If xCounter >= 300 Then
DoCmd.Rename "Tbl_FS", acTable, "FS"
DoCmd.Rename "Tbl_All", acTable, "All"
DoCmd.Rename "Tbl_Customers", acTable, "Customers"
DoCmd.Rename "Tbl_Rates", acTable, "Rates"
DoCmd.Rename "Tbl_Temp", acTable, "Temp"
DoCmd.Rename "Tbl_Users", acTable, "Users"
End If
End Function
and I created a macro to run that function in a startup (RunCode) and I named the macro (AutoExec).
my problem is when I open (the access tables file) by clicking, the code works but when I use the executive file that linked with (the access tables file), the code doesn't work!!
how to make the code run when I work on the executive file without open (the access tables file) and without doing that from the executive file.
Upvotes: 0
Views: 33
Reputation: 55981
That is not possible - the backend (data) file is "dead" in this regard.
The closest you can get some action in the backend, is to create data macros.
Upvotes: 0