Jaymond Flurrie
Well-known Member
- Joined
- Sep 22, 2008
- Messages
- 921
- Office Version
- 365
- Platform
- Windows
This should be more than easy for any of you using Access VBA a lot.
I would need a program that prints me all the fields in my db. It's similar to Excel's
so something like
but for sure that one above doesn't work. I'm running this from Excel and I have set a reference to Microsoft Access 14.0 Object Library, but I have absolutely no idea what the actual datatypes of those acdb, actbl and acfld should be.
So in other words, please correct the code of Sub accessversionprintallfields to a working one. I really think that it shouldn't be very hard for anyone who has programmed against Access before.
I would need a program that prints me all the fields in my db. It's similar to Excel's
Code:
Sub excelversionprintallsheets()
Dim wkb As Workbook
Dim wks As Worksheet
Set wkb = ThisWorkbook
For Each wks In wkb.Worksheets
Debug.Print wks.Name
Next wks
End Sub
so something like
Code:
Sub accessversionprintallfields()
Dim acdb As access.database
Dim actbl As access.table
Dim acfld As access.Field
Set acdb = "c:\accessdatabase.accdb"
For Each actbl In acdb.tables
For Each acfld In actbl.Fields
Debug.Print acfld.Name
Next acfld
Next actbl
End Sub
but for sure that one above doesn't work. I'm running this from Excel and I have set a reference to Microsoft Access 14.0 Object Library, but I have absolutely no idea what the actual datatypes of those acdb, actbl and acfld should be.
So in other words, please correct the code of Sub accessversionprintallfields to a working one. I really think that it shouldn't be very hard for anyone who has programmed against Access before.