Database fields

Posted on 2000-05-09
Last Modified: 2010-05-02
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?
Question by:mi5
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 43

Expert Comment

ID: 2792853
Data1.Recordset!<FieldName> where <fieldName> is the name of your field.

Expert Comment

ID: 2792877
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


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

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

If you need more than that let me know.


Author Comment

ID: 2793087
Is there any easy way of finding out how many records and fields there are in the table?
LVL 43

Accepted Solution

TimCottee earned 50 total points
ID: 2793102
Number of records  = Data1.Recordset.RecordCount
Number Of fields =

Author Comment

ID: 2793103
Is there any easy way of finding out how many records and fields there are in the table?

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month8 days, 7 hours left to enroll

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question