[AccessD] determining the datatype of a bound control

Charlotte Foust cfoust at infostatsystems.com
Wed Mar 24 17:21:38 CST 2004


You can use the Clone method to create a copy of the ADO recordset, but
it is not the same as the DAO recordsetclone at all.

Charlotte Foust

-----Original Message-----
From: John W. Colby [mailto:jwcolby at colbyconsulting.com] 
Sent: Wednesday, March 24, 2004 12:24 PM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] determining the datatype of a bound control


This is cool. Mil Gracias.

Since you responded, is there any way to do the RecordsetClone thing in
ADO?

John W. Colby
www.ColbyConsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Charlotte
Foust
Sent: Wednesday, March 24, 2004 11:38 AM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] determining the datatype of a bound control


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
--
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.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