Solved

Retrieve from access table.

Posted on 2000-03-21
6
150 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

758 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

17 Experts available now in Live!

Get 1:1 Help Now