[AccessD] determining the datatype of a bound control

Charlotte Foust cfoust at infostatsystems.com
Wed Mar 24 10:38:06 CST 2004


John,

This will do it if your form's recordsource is a table

    Dim strCtlSrc As String
    Dim strDataSrc As String
    Dim rst As ADODB.Recordset
    Dim intType As Integer
    
    strDataSrc = Me.RecordSource
    strCtlSrc = txtDOB.ControlSource
    Set rst = New ADODB.Recordset
    rst.Open strDataSrc , CurrentProject.Connection, , , adCmdTable
    
    intType = rst.Fields(strCtlSrc).Type

Assuming the underlying field is a date, this will return a 7, which is
adDate

Charlotte Foust

-----Original Message-----
From: John W. Colby [mailto:jwcolby at colbyconsulting.com] 
Sent: Tuesday, March 23, 2004 12:08 PM
To: AccessD
Subject: [AccessD] determining the datatype of a bound control


I currently determine the data type of the data that a control is
displaying by the following code:

Dim strCtlSrc As String
Dim rst As DAO.Recordset
Dim intType As Integer
    strCtlSrc = txtDOB.ControlSource
    Set rst = Me.RecordsetClone
    intType = rst.Fields(strCtlSrc).Type

Is there a similar method of getting at this from ADO?

John W. Colby
www.ColbyConsulting.com


-- 
_______________________________________________
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