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!

adjust label from recordset 1

Status
Not open for further replies.

pingit

MIS
Nov 24, 2003
37
NZ
Hello All

I would like to loup through a recordset setting three label captions with results. I cant attach a counter to the label in a loop (if that makes sense)
lCnt = 1
Do While Not RS.EOF
Me.Label3 & lCnt & .Caption = RS("record")
RS.MoveNext
lCnt = lCnt + 1
Loop

The labels are called Label31, 32, 33. The record set only ever returns 3 results


Thanks
pingIT
 
Can we assume this is MS Access? If so, I would try:

Code:
lCnt = 1 
Do While Not RS.EOF 
   Me("Label3" & lCnt).Caption = RS("record") 
   RS.MoveNext 
   lCnt = lCnt + 1 
Loop

Duane
Hook'D on Access
MS Access MVP
 
Hello dhookom

Tried the code and it worked a treat!

Thanks for your help
pingIT
 
I would definitely change the name of the Label31 to something more meaningful, like lblRSCount1

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top