Charlotte Foust
cfoust at infostatsystems.com
Wed Mar 24 17:27:20 CST 2004
I qualified it because that was what the example was for. If you were
using a query, you would have to do it differently, probably by using a
command object. I wasn't sure whether you were looking for some
multi-purpose code or just asking in general, and I wanted you to be
fully aware that what I posted only applied to a table. The adCmdTable
would be adCmdText or adStoredProc if you were using a select statement
or a query, but if you're looking for a way to fit it into your
framework, you would have to be able to determine what kind of thing the
form was bound to before proceeding.
Charlotte Foust
-----Original Message-----
From: John W. Colby [mailto:jwcolby at colbyconsulting.com]
Sent: Wednesday, March 24, 2004 12:51 PM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] determining the datatype of a bound control
I just got the "if it's a table" part. That's not so nice since many
forms are bound to queries.
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