"N. Graves" <ng*****@REMOVEyahoo.com> wrote:
Mark thank you for you response and your quick posting.
I'm not very familiar with DAO I using ADO to access my database. I
will continue to research you suggestion but to you have an ADO
example? I could not find and information on the CurrentDB()
DAO is officially "obsolete," although it is still the preferred
object model if you are working strictly with a Jet (MDB)
database. To use it, you will need to add a reference to DAO
to your project. To do this, press <ALT><F11> to bring up
the VBA dev environment. Then select Tools/References from
the menu, and check "Microsoft DAO 3.6 Object Library."
Here is a fancier version of what I posted yesterday.
This should give you a pretty good idea of how the
DAO object library works. Output from this function is
written to the Debug window (Ctrl + G) in the VBA
dev environment.
-Mark
=================================
Public Function sp_help() As Boolean
sp_help = True
Dim db As DAO.Database
Dim tbl As DAO.TableDef
Dim fld As DAO.Field
Dim sStmt As String
Const constPad01 = 25
Const constPad02 = 15
Set db = CurrentDb()
For Each tbl In db.TableDefs
Debug.Print ""
Debug.Print tbl.Name
For Each fld In tbl.Fields
sStmt = " " & fld.Name & String(constPad01 - Len(fld.Name), " ")
Select Case fld.Type
Case dbLong:
sStmt = sStmt & "long" & " (" & fld.Size & ")"
Case dbText:
sStmt = sStmt & "text" & " (" & fld.Size & ")"
Case dbMemo:
sStmt = sStmt & "memo" & " (" & fld.Size & ")"
Case dbDate:
sStmt = sStmt & "date" & " (" & fld.Size & ")"
Case dbTime:
sStmt = sStmt & "time" & " (" & fld.Size & ")"
Case dbTimeStamp:
sStmt = sStmt & "timestamp" & " (" & fld.Size & ")"
Case dbLongBinary:
sStmt = sStmt & "long binary" & " (" & fld.Size & ")"
Case dbBigInt:
sStmt = sStmt & "BigInt" & " (" & fld.Size & ")"
Case dbBinary:
sStmt = sStmt & "Binary" & " (" & fld.Size & ")"
Case dbVarBinary:
sStmt = sStmt & "VarBinary" & " (" & fld.Size & ")"
Case dbBoolean:
sStmt = sStmt & "Boolean" & " (" & fld.Size & ")"
Case dbByte:
sStmt = sStmt & "Byte" & " (" & fld.Size & ")"
Case dbChar:
sStmt = sStmt & "Char" & " (" & fld.Size & ")"
Case dbDouble:
sStmt = sStmt & "Double" & " (" & fld.Size & ")"
Case dbFloat:
sStmt = sStmt & "Float" & " (" & fld.Size & ")"
Case dbInteger:
sStmt = sStmt & "Integer" & " (" & fld.Size & ")"
Case Else:
sStmt = sStmt & fld.Type & " (" & fld.Size & ")"
End Select
Debug.Print sStmt
Next
Next
Set db = Nothing
End Function