[AccessD] [dba-OT] Transfer field names to excel,
Rocky Smolin
rockysmolin at bchacc.com
Thu Oct 12 18:07:31 CDT 2017
Thank you. You're very good
https://www.youtube.com/watch?v=86DiuQAkADI
r
-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Stuart McLachlan
Sent: Thursday, October 12, 2017 3:24 PM
To: Off Topic; access Developers discussion and problem solving
Subject: Re: [AccessD] [dba-OT] Transfer field names to excel,
On 12 Oct 2017 at 14:43, Rocky Smolin wrote:
> Martin:
>
> Lot of good tools there but didn't see one that would get the field
> names into an Excel sheet. I'll keep looking, though.
>
>
Just knocked this up for you. You can open the resultant Tab delimited
text file in Excel.
Function GetTableData() As Long
Dim Tbls() As String
Dim t As TableDef
Dim f As Field
Dim x As Long
Dim y As Long
Dim tblCount As Long
Dim maxfields As Long
'Get required array dimension
For Each t In CurrentDb.TableDefs
If Left$(t.Name, 4) <> "mSys" Then
tblCount = tblCount + 1
y = t.Fields.Count
If y > maxfields Then maxfields = y
End If
Next
ReDim Tbls(1 To tblCount, 0 To maxfields) 'get table and field names into
array For Each t In CurrentDb.TableDefs
If Left$(t.Name, 4) <> "mSys" Then
x = x + 1
y = 0
Tbls(x, 0) = t.Name
For Each f In t.Fields
y = y + 1
Tbls(x, y) = f.Name
Next
End If
Next
'Export to tab delimited file
Open CurrentProject.Path & "\TableFieldNames.txt" For Output As #1 For y = 0
To maxfields
For x = 1 To tblCount - 1
Print #1, Tbls(x, y) & Chr$(9);
Next
Print #1, Tbls(tblCount, y)
Next
Close #1
MsgBox "Done"
End Function
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
More information about the AccessD
mailing list