Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 4th, 2004, 04:16 PM
Authorized User
 
Join Date: Apr 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Populating a text box from a RecordSet

Hello, I need help

Im working on an ACCESS form and I am trying to populate a text box with 2 fields from a recordset. I am trying to use a "For Loop" to do this and its not writing all the records in the recordset to the text box. It only writes the first record. The ESSN is used for employee social security number which is getting entered by the user typing it into txtSSN.

Here is my code:
myRS2.ActiveConnection = CurrentProject.Connection
mySQL2 = "Select ESSN,PNO,HOURS From Works_On Where ESSN=" & txtSSN
myRS2.Open (mySQL2)

'Write employee project(s) and hours to text field
For empCounter = 0 To myRS2.EOF
    txtWorkHrs = "Project" & myRS2("PNO") & "-" & myRS2("HOURS") & "Hours"
    myRS2.MoveNext
Next

Can anyone here help me with this and show me the correct way of doing this? It would be greatly appreciated. This is for a project that Im working on for my class in College.

Thank you for your time.
Eric
 
Old April 4th, 2004, 04:22 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Euh, what exactly has this to do with feedback about the P2P Site and forum?

You may try your luck in the Access forum instead.....

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Please : populating selection box kumar_siva HTML Code Clinic 2 December 29th, 2005 05:45 AM
populating an array from text box olddog VB.NET 2002/2003 Basics 1 July 27th, 2005 08:30 AM
Populating text box from RecordSet ersp Access VBA 5 April 4th, 2004 08:52 PM
How to bind text box to recordset fields? cici VB How-To 2 December 1st, 2003 02:10 AM
populating a box sporkman43 Classic ASP Basics 0 August 18th, 2003 02:04 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.