Solved

Database fields

Posted on 2000-05-09
5
147 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

911 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now