[AccessD] Abstract question

Shamil Salakhetdinov shamil at users.mns.ru
Sun Feb 11 08:06:49 CST 2007


Hello Arthur,

The task of "realizing that certain fields of any arbitrary recordset ought
to be checkboxes, others formatted short-date, etc." can be solved by using
recordset field's DisplayControl property, which defines what is a
preferable way to display field's value:

DisplayControl = 109 - textbox
DisplayControl = 106 - checkbox
DisplayControl = 110 - listbox
DisplayControl = 111 - combobox

Format property defines output format etc.

You can find other useful properties to generate autoform - the following
code can be used for that if you uncomment two code lines in Case Else code
block:

Public Sub TestDebugPrint(ByVal vstrRstName As String)
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim fld As DAO.Field
Dim fld1 As DAO.Field
Dim prp As DAO.Property
    Set dbs = CurrentDb
    Set rst = dbs.OpenRecordset(vstrRstName)
    For Each fld In rst.Fields
        With fld
            Debug.Print .Name
            For Each prp In fld.Properties
               With prp
                Select Case .Name
                   Case "DisplayControl", "Format":
                    Debug.Print vbTab & prp.Name & " = " & _
                         propertyValue(prp)
                Case Else
                    'Debug.Print vbTab & prp.Name & " = " & _
                    '     propertyValue(prp)
                End Select
               End With
            Next prp
        End With
    Next fld
End Sub
Private Function propertyValue(ByRef rprp As DAO.Property) As Variant
On Error GoTo HandleErr
    propertyValue = rprp.Value
    Exit Function
HandleErr:
    propertyValue = "(N/A)"
End Function

--
Shamil
 
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of artful at rogers.com
Sent: Sunday, February 11, 2007 3:31 PM
To: AccessD at databaseadvisors. com
Subject: [AccessD] Abstract question

Does anyone have an idea how to generate an autoForm from any arbitrary
recordset? Ideally, such a class would have the smarts to realize that
certain fields ought to be checkboxes, others formatted short-date, etc.
 
Arthur
-- 
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