T
Tommy7571
Hello,
I have two problems I want to rename all tables of a database because if I
import these tables they get the name public + 'realname' so I don't want to
keep public.
Sub Renamingtables()
Dim i, j, k As Integer
Dim s, newfile, searchstring, SearchChar As String
Dim tbl As TableDef, dbs As Object
Dim oldName, newname As String
Set dbs = CurrentDb.TableDefs
For Each tbl In dbs
oldName = dbs.Name
DoCmd.SelectObject acTable, oldName, True
SearchChar = "public_" ' Search for "Public".
searchstring = oldName
MyPos = InStr(1, searchstring, SearchChar, 1)
If MyPos <> 0 Then
DoCmd.Rename oldName, acTable, newname
End If
Next tbl
End Sub
This was a trial but it doesn't work although I tried many ways...
Can somebody help me ?
Secondly everytime I import tables from the server the fieldformat for all
fields with not integer numbers is 'decimal' but I have so much problems with
this format that I prefere double or Single. I tried this under options but
it doesn't change anything. How to change all fieldformats which are numeric
from decimal to double ?
Thanks very much
Thomas Willms
I have two problems I want to rename all tables of a database because if I
import these tables they get the name public + 'realname' so I don't want to
keep public.
Sub Renamingtables()
Dim i, j, k As Integer
Dim s, newfile, searchstring, SearchChar As String
Dim tbl As TableDef, dbs As Object
Dim oldName, newname As String
Set dbs = CurrentDb.TableDefs
For Each tbl In dbs
oldName = dbs.Name
DoCmd.SelectObject acTable, oldName, True
SearchChar = "public_" ' Search for "Public".
searchstring = oldName
MyPos = InStr(1, searchstring, SearchChar, 1)
If MyPos <> 0 Then
DoCmd.Rename oldName, acTable, newname
End If
Next tbl
End Sub
This was a trial but it doesn't work although I tried many ways...
Can somebody help me ?
Secondly everytime I import tables from the server the fieldformat for all
fields with not integer numbers is 'decimal' but I have so much problems with
this format that I prefere double or Single. I tried this under options but
it doesn't change anything. How to change all fieldformats which are numeric
from decimal to double ?
Thanks very much
Thomas Willms