Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 23rd, 2005, 03:59 AM
Registered User
 
Join Date: Sep 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Populate unbound form with recordset

Hi
- one unbound continuous form (form1)
- one recordset (via DAO)
- 2 fields: NAP and DateNAP ()

Onload i only get one record (the last one) from the recordset (=10).
How can i pull all the records into the form.

code--
Private Sub Form_Load()
Dim rst As DAO.Recordset
Dim strSQL As String
Dim dbs As Database

Set dbs = CurrentDb
strSQL = "Select N_APagamento, Data_APagamento, ID_Programa, ID_Medida FROM AUT_PAGAMENTO WHERE ID_Programa = '26'"

Set rst = dbs.OpenRecordset(strSQL)

Do While Not rst.EOF
    NAP = rst!N_APagamento
    Data_NAP = rst!Data_APagamento
    rst.MoveNext
Loop

rst.Close
Set rst = Nothing
dbs.Close

End Sub
---
Thanks



Reply With Quote
  #2 (permalink)  
Old September 26th, 2005, 10:01 AM
Authorized User
 
Join Date: Jun 2005
Location: , , .
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

its not surprising that your fields "NAP" and "Data_NAP" contain only the last values, because that is exactly what your code is doing.

What is the reason you have not made the record source of the form equal to "Select N_APagamento, Data_APagamento, ID_Programa, ID_Medida FROM AUT_PAGAMENTO WHERE ID_Programa = '26'"?? This should accomplish what it seems you want to do



Reply With Quote
  #3 (permalink)  
Old September 26th, 2005, 06:06 PM
Friend of Wrox
 
Join Date: Jul 2005
Location: Oklahoma City, OK, USA.
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You really can not make a continuous form unbound in Access. You can make a form look like a continuous form and load all the records into text boxes.

Why would you want an unbond continuous form?

Boyd
"Hi Tech Coach"
Access Based Accounting/Business Solutions developer.
http://www.officeprogramming.com
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i populate datagrid from a recordset object bisigreat VB How-To 1 August 6th, 2009 04:30 AM
Populate combobox from ADO recordset - RESOLVED! robzyc Access VBA 8 May 23rd, 2008 01:07 AM
how to display recordset in unbound form huela Access VBA 0 October 12th, 2004 11:58 PM
How do i populate datagrid from a recordset object bisigreat BOOK: ASP.NET Website Programming Problem-Design-Solution 1 September 22nd, 2004 11:35 AM
using fields in recordset to populate textbox stoneman Access 2 October 7th, 2003 11:03 AM



All times are GMT -4. The time now is 05:55 PM.


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