Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to populate an unbound continious form

Status
Not open for further replies.

planetdrouin

Technical User
Dec 29, 2001
36
US
My code correctly populates each of the unbound controls on the first record, but each subsequent record has the same data as the first. I am rather new to programming, so I am must be missing something rather simple (I hope).

My code looks like:

Private Sub Form_Load()
Dim intX As Integer, RowTotal As Long, db As DAO.Database, qdf As DAO.QueryDef, frm As Form, ColumnCount As Integer, rs As DAO.Recordset
Set db = CurrentDb
Set qdf = db.QueryDefs("QryAccountsExpenseDetail")
Set rs = qdf.OpenRecordset
ColumnCount = rs.Fields.Count
rs.MoveFirst
While Not rs.EOF
RowTotal = 0
For intX = 1 To ColumnCount
Me("Text" + Format(intX)) = Nz(rs(intX - 1), 0)
Me("Label" + Format(intX)).Caption = rs(intX - 1).Name
Next intX
Me("Label" + Format(ColumnCount + 1)).Caption = "Totals"
For intX = 3 To ColumnCount
RowTotal = RowTotal + Nz(rs(intX - 1), 0)
Me("Text" + Format(intX)).ColumnHidden = False
Next intX
For intX = (ColumnCount + 2) To TotalColumns
Me("Text" + Format(intX)).ColumnHidden = True
Me("Label" + Format(intX)).Visible = False
Next intX
' Place row total in text box
Me("Text" + Format(ColumnCount + 1)) = RowTotal
rs.MoveNext
Wend
End Sub

I thought that the rs.movenext would be sufficient, however I now realize it isn't. It moves to the next record in my recordset, but how do I move to the controls on the form of the next record.

I am using Access XP, and the first two columns of my data are Date and Transaction description. Any help would be greatly appreciated.

Lawrence
 
On more thing, my form is in datasheet and not continuous (I wish I would check my spelling a little more often) view.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top