replace CStr(vName) with tdf.Name in code above
I made a collection in one spot in my code so I could remove the links - hard to do without a baseline set of table names.
Snippet untested
With db.TableDefs
Set cTables = New Collection
For Each tdf In db.TableDefs
If Len(tdf.Connect) And Not tdf.Name Like "MSys*" Then
db.TableDefs(CStr(vName)).RefreshLink
End If
Next tdf
You might consider using EXIT FOR
FOR lvl = 1 to 25
IF ... THEN
EXIT FOR
END IF
....
NEXT lvl
Using END IF is also helpful if you are stepping thorough the code so you can stop and look at things in the middle of the IF evaluation.
Consider using Excel instead of Access to do the task. Just establish a DAO or ADO reference and a connection to your MDB and use Excel VBA to populate whatever you want.
I do Excel "reports" this way all the time.
ADO to SQL Server:
Set con = New ADODB.Connection
Set RS = New...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.