Solved

Retrieve from access table.

Posted on 2000-03-21
6
151 Views
Last Modified: 2010-05-02
How can i retrive data from tables created in access.I can write data to the tables but reading from the tables gives me a headache!!I want the data to be displayed in a form on textboxes if possible.
All suggestions are welcome.

Thanks in advance.
0
Comment
Question by:onalenna
  • 3
  • 2
6 Comments
 

Expert Comment

by:pgg
ID: 2639524
Example in DAO

Dim DB as database
Dim RS as recordset
  Set DB = opendatabase("the name and path of the database")
  Set RS = DB.OpenRecordset("Select * from TABLENAME")
  Do until Rs.Eof
     From1.List1.Additem  RS!Fieldname that you want to use
     RS.MoveNext
  Loop
  RS.Close
  Set RS = Nothing

 Comments
 
 Example of select statement:
   Select * from Customers where changedby =' & UserId & '"
   Select * from TABLENAME where FIELD = CRITERIA Order By FieldName




 
0
 
LVL 14

Accepted Solution

by:
wsh2 earned 50 total points
ID: 2642054
1. Add a Data Control to your form.. set its DataBase property to your Access mdb file.. and Set its RecordSource property to the table you want (a dropdown).

2. Add a Textbox for each Field. In each Textboxs property.. Set the Datasource Property to the Data Control you created in step 1 (a dropdown).. and set the DataField property to the Table field you want (a dropdown).

Voile you are done.. <smile>.

The data control will allow you to move from record to record.. and if you like, you can add code to your textbox events.

----------------------------------
pqq:
Shame on you for locking down this question.. as Onalenna writes: "All suggestions are welcome".. <smile>.
0
 

Expert Comment

by:pgg
ID: 2643487
Sorry, to quick !
/pgg
0
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.

 
LVL 14

Expert Comment

by:wsh2
ID: 2643607
Apology accepted.. Well done pgg.. <smile>
0
 

Expert Comment

by:pgg
ID: 2643677
pgg changed the proposed answer to a comment
0
 

Author Comment

by:onalenna
ID: 2648272
Thanks very much wsh2.
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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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…

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

20 Experts available now in Live!

Get 1:1 Help Now