Solved

Database fields

Posted on 2000-05-09
5
161 Views
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?
0
Comment
Question by:mi5
  • 2
  • 2
5 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 2792853
Data1.Recordset!<FieldName> where <fieldName> is the name of your field.
0
 
LVL 4

Expert Comment

by:abaldwin
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

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
 

Author Comment

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

Accepted Solution

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

Author Comment

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

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

792 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