Database fields

If I have a data control on my form linked to an Access database (with a table selected in RecordSource) is it possible to get the contents of a field on the current record without linking another control to the data control?
mi5Asked:
Who is Participating?
 
TimCotteeHead of Software ServicesCommented:
Number of records  = Data1.Recordset.RecordCount
Number Of fields =
Data1.Recordset.Fields.Count
0
 
TimCotteeHead of Software ServicesCommented:
Data1.Recordset!<FieldName> where <fieldName> is the name of your field.
0
 
abaldwinCommented:
I take it you are talking about a vb form with a datacontrol that is bound.

Control type       Name
Datacontrol - datMyBoundControl
Text box - txtMyUnboundControl
First Data Field  - CompanyName


The following line will set the text box to contain the data in the Company name field

Either

txtMyUnboundControl.text = datMyBoundControl.Recordset.fields("CompanyName")

Or
txtMyUnboundControl.text = datMyBoundControl.Recordset.fields(0)

If you need more than that let me know.

Andy
0
 
mi5Author Commented:
Is there any easy way of finding out how many records and fields there are in the table?
0
 
mi5Author Commented:
Is there any easy way of finding out how many records and fields there are in the table?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.