Full Version: Getting Datatype Of Fields On A Form
UtterAccess Forums > Microsoft® Access > Access Forms
Tim Freeman
Is there a way to get the datatype of a field on a form just from the fields properties (assuming no formatting applied)?
If on a form you have a TextBox field the underlying data could be Numeric, Date or Text but there does not seem to be any way of getting the type except by creating a query based on the recordsource, eg SET rcd = currentdb.openrecordset("SELECT [ControlSource] FROM [RecordSource] ") and then looking at the data type for the field in the recordsource. While this would work it is somewhat ineficient!
Any suggestions gratefully received. Thanks.
If the form has a recordsource then it also has a recordsetclone which is a DAO.Recordset.
ook at it's fields collection.
The bigger question here, I think, is why you're trying to do this! If we knew that we could possibly give you a simple solution.
Linq ;0)>
Tim Freeman
If you are using the run time, you cannot use the right click to filter, copy or paste in a field. I am playing around with a code equvalent. So far I have a popup screen which only appears when the user right clicks in a field and some code to get the current control. I do not know the datatype of the field the user has clicked in (I am writting a generic solution). Given how clever some users can (not) be, I want to apply the right type of filter. Unfortunately this is not .DataType property for the field hence the question.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.