Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
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 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 September 23rd, 2005, 03:59 AM
Registered User
 
Join Date: Sep 2005
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



 
Old September 26th, 2005, 10:01 AM
Authorized User
 
Join Date: Jun 2005
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



 
Old September 26th, 2005, 06:06 PM
Friend of Wrox
 
Join Date: Jul 2005
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





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





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