473,327 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Printing MS Access Database Structure in ASP

How can I print the database structure, including non default
variables like Requiered, FieldSize, and most important DESCRIPTION. I
want a table like this:

-----------------------------------------------
| Name | Type | Size | Required | Description |
-----------------------------------------------
| ... | ... | ... | ... | ... |
Does anyone know how to do this? I can only print Name and Type as
they are predefined variables. Thanks in advance!

Alternatively, how can I copy my variable descriptions from MS Access'
Design View to another program (SPSS or EXCEL or a text document)? MS
Access doesn't allow copying the description fields (only one at a
time and I have 900 variables in my tables!!) and importing into SPSS
does not include the descriptions. All help is more than welcome!

Cheers!

Patricio
Nov 12 '05 #1
5 7719
pa*************@hotmail.com (Pato Secruza) wrote in message news:<21**************************@posting.google. com>...
How can I print the database structure, including non default
variables like Requiered, FieldSize, and most important DESCRIPTION. I
want a table like this:

-----------------------------------------------
| Name | Type | Size | Required | Description |
-----------------------------------------------
| ... | ... | ... | ... | ... |
Does anyone know how to do this? I can only print Name and Type as
they are predefined variables. Thanks in advance!

Alternatively, how can I copy my variable descriptions from MS Access'
Design View to another program (SPSS or EXCEL or a text document)? MS
Access doesn't allow copying the description fields (only one at a
time and I have 900 variables in my tables!!) and importing into SPSS
does not include the descriptions. All help is more than welcome!

Cheers!

Patricio


Patricio,
cuidate con el nombre "pato"... significa maricon! (Lo juro!)
You can download the DFUtility addin from Danny Lesandrini's
website...

You could use something like this...

Public Sub ShowFieldDescriptions(ByVal strTable As String)
Dim db As DAO.database
Dim tdf As DAO.tabledef
Dim fld As DAO.Field

Set db = CurrentDb
Set tdf = db.TableDefs(strTable)
For Each fld In tdf.Fields
Debug.Print fld.Name, fld.Properties("Description")
Next fld

Set fld = Nothing
Set tdf = Nothing
Set db = Nothing

End Sub

If you wanted, you could populate a table with the information, and
send that to Excel or whatever you want that SPSS or whatever can
read...

HTH a little,
Pieter
Nov 12 '05 #2
pi********@hotmail.com (Pieter Linden) wrote in message news:<bf**************************@posting.google. com>...
pa*************@hotmail.com (Pato Secruza) wrote in message news:<21**************************@posting.google. com>...
How can I print the database structure, including non default
variables like Requiered, FieldSize, and most important DESCRIPTION. I
want a table like this:

-----------------------------------------------
| Name | Type | Size | Required | Description |

-----------------------------------------------
| ... | ... | ... | ... | ... |
Does anyone know how to do this? I can only print Name and Type as
they are predefined variables. Thanks in advance!

Alternatively, how can I copy my variable descriptions from MS Access'
Design View to another program (SPSS or EXCEL or a text document)? MS
Access doesn't allow copying the description fields (only one at a
time and I have 900 variables in my tables!!) and importing into SPSS
does not include the descriptions. All help is more than welcome!

Cheers!

Patricio

Public Sub DocumentTable(ByVal strTable As String)
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Dim rs As DAO.Recordset

Set db = CurrentDb
DoCmd.RunSQL "DELETE * FROM ztblDocumentation;", dbFailOnError

'--Open the recordset that the documentation data will go into
Set rs = db.OpenRecordset("ztblDocumentation", dbOpenTable)

'--Open the tabledef that will be documented.
Set tdf = db.TableDefs(strTable)
For Each fld In tdf.Fields
rs.AddNew
rs.Fields("TableName") = tdf.Name
rs.Fields("FieldName") = fld.Name
rs.Fields("FieldType") = GetFieldType(fld.Type)
rs.Fields("FieldSize") = fld.Size
rs.Fields("Required") = fld.Required
rs.Fields("Description") = GetFieldDescription(fld.Name,
tdf.Name)
rs.Update
Next fld

rs.Close
Set rs = Nothing
Set fld = Nothing
Set tdf = Nothing
Set db = Nothing
End Sub

Private Function GetFieldType(ByVal lngType As Long) As String

Select Case lngType
Case dbBoolean
GetFieldType = "Yes/No"
Case dbCurrency
GetFieldType = "Currency"
Case dbDate
GetFieldType = "Date/Time"
Case dbGUID
GetFieldType = "GUID"
Case dbInteger
GetFieldType = "Integer"
Case dbLong
GetFieldType = "Long Integer"
Case dbLongBinary
GetFieldType = "Long Binary"
Case dbMemo
GetFieldType = "Memo"
Case dbNumeric
GetFieldType = "Numeric"
Case dbSingle
GetFieldType = "Single"
Case dbText
GetFieldType = "Text"
Case dbTime
GetFieldType = "Time"
Case dbTimeStamp
GetFieldType = "Date"
Case dbVarBinary
GetFieldType = "VarBinary.... whatever!"
Case Else
GetFieldType = vbNullString
End Select

End Function
Public Function GetFieldDescription(ByVal strField As String, ByVal
strTable As String) As String
On Error GoTo ErrHandler

Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field

Set db = CurrentDb
Set tdf = db.TableDefs(strTable)
Set fld = tdf.Fields(strField)

GetFieldDescription = fld.Properties("Description")

Set fld = Nothing
Set tdf = Nothing
Set db = Nothing

Exit Function

ErrHandler:
'For Each Err In Errors
Err.Clear
'Next Err
GetFieldDescription = ""

End Function

Okay, then you could output the whole thing to HTML... just specify
the table and use the OutputTo function...
Nov 12 '05 #3
Okay, got it working to my satisfaction... although I output the
result to HTML instead of ASP... (just change the outputTo constant to
....ASP)

'--- begin dodgy code....

Public Sub DocumentTable(ByVal strTable As String)
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Dim rs As DAO.Recordset

Set db = CurrentDb
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE * FROM ztblDocumentation;", dbFailOnError
DoCmd.SetWarnings True

'--Open the recordset that the documentation data will go into
Set rs = db.OpenRecordset("ztblDocumentation", dbOpenTable)

'--Open the tabledef that will be documented.
Set tdf = db.TableDefs(strTable)
For Each fld In tdf.Fields
rs.AddNew
rs.Fields("TableName") = tdf.Name
rs.Fields("FieldName") = fld.Name
rs.Fields("FieldType") = GetFieldType(fld.Type)
If fld.Type = dbText Then
rs.Fields("FieldSize") = fld.Size
End If
rs.Fields("Required") = fld.Required
rs.Fields("Description") = GetFieldDescription(fld.Name,
tdf.Name)
rs.Update
Next fld

rs.Close
Set rs = Nothing
Set fld = Nothing
Set tdf = Nothing
Set db = Nothing
End Sub

Private Function GetFieldType(ByVal lngType As Long) As String

Select Case lngType
Case dbBoolean
GetFieldType = "Yes/No"
Case dbCurrency
GetFieldType = "Currency"
Case dbDate
GetFieldType = "Date/Time"
Case dbGUID
GetFieldType = "GUID"
Case dbInteger
GetFieldType = "Integer"
Case dbLong
GetFieldType = "Long Integer"
Case dbLongBinary
GetFieldType = "Long Binary"
Case dbMemo
GetFieldType = "Memo"
Case dbNumeric
GetFieldType = "Numeric"
Case dbSingle
GetFieldType = "Single"
Case dbText
GetFieldType = "Text"
Case dbTime
GetFieldType = "Time"
Case dbTimeStamp
GetFieldType = "Date"
Case dbVarBinary
GetFieldType = "VarBinary.... whatever!"
Case Else
GetFieldType = vbNullString
End Select

End Function
Public Function GetFieldDescription(ByVal strField As String, ByVal
strTable As String) As String
On Error GoTo ErrHandler

Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field

Set db = CurrentDb
Set tdf = db.TableDefs(strTable)
Set fld = tdf.Fields(strField)

GetFieldDescription = fld.Properties("Description")

Set fld = Nothing
Set tdf = Nothing
Set db = Nothing

Exit Function

ErrHandler:
'For Each Err In Errors
Err.Clear
'Next Err
GetFieldDescription = ""

End Function
Public Sub OutputTableToHTML(ByVal strOutputPath As String)
DoCmd.OutputTo acOutputTable, "ztblDocumentation", acFormatHTML,
strOutputPath & "\Dox.html", True
End Sub

'---End dodgy Code
Nov 12 '05 #4
Hey Thanks a lot Pieter!

I`ll check it out! I'm sure I'll be able to do it now.
Did you program it as a windows application or as a web script?

Nunca he escuchado lo de Pato... en cuál país aprendiste castellano, o
si eres latino, de cuál país eres?

I appreciate your effort!

Patricio
Nov 12 '05 #5
pa*************@hotmail.com (Pato Secruza) wrote in message news:<21**************************@posting.google. com>...
Hey Thanks a lot Pieter!

I`ll check it out! I'm sure I'll be able to do it now.
Did you program it as a windows application or as a web script?

Nunca he escuchado lo de Pato... en cuál país aprendiste castellano, o
si eres latino, de cuál país eres?

I appreciate your effort!

Patricio


The code? I wrote it myself (well, probably with a lot of input from
this NG, to be totally honest). It would run inside Access... You'd
just put it in a code module...

Oi lo de pato desde hace mucho tiempo... aprendi en la calle, en la
escuela, en la universidad, en Espana... Latino? Yo?!! Soy MUY
rubio... mi padre es holandes.... pero la madre muy yanqui
Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Steve Johnson | last post by:
Been banging my head on this for two days now. Hope someone can help! My test program below is in the form of a single JSP, with a Node class build in. (All the coded needed to run is below.) ...
3
by: Random Person | last post by:
Does anyone know how to use VBA to relink tables between two MS Access databases? We have two databases, one with VBA code and the other with data tables. The tables are referenced by linked...
49
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The...
6
by: latosca68 | last post by:
I need to demostrate, in a forensic job, that I can change (insert, update, delete) records in a table of an access database without trace. How can I do this ? I plan to make the queries or export...
1
by: Frank.Sebesta | last post by:
I have a employees database with a picture that shows on a form with employee information. Similar to the Northwinds sample database. When I print the record, my output is only the data and does...
4
by: Arif | last post by:
I C# code prints very slow as compared to a third party barcode printing software. That software prints approximately 10 labels in 2 seconds while my C# code prints 10 labels in 5 to 6 seconds. And...
2
by: Allen Davis | last post by:
I have some hierarchical data bound to a series of nested DataLists and DataGrids for which I'd like to be able to provide the end-user some targeted printing capabilities. By that I mean being...
15
by: sparks | last post by:
We get more and more data done in excel and then they want it imported into access. The data is just stupid....values of 1 to 5 we get a lot of 0's ok that alright but 1-jan ? we get colums...
2
by: coldblood22 | last post by:
Well in my Application i am using the java Printable interface to print the GUI. The printing is done fine but once done with the printing my program breaks off with the database file without. Well...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.