Do Until RS1.EOF
Debug.Print RS1.Fields(0).Value
RS1.MoveNext
Loop
this code loop a dates fields.
i need to change the text name of each nutton in sheet attached, hot to via vba code?
note:
1)the rs1 loop contain only and always 3 filed dates
2)i need for filds(0).value modify the text name of first button, renamed for filds(1).value modify the text name of second button, ecc
3) The format of dates is MM/YYYY
CHANGE text in button on sheet
-
- PlatinumLounger
- Posts: 4355
- Joined: 26 Apr 2010, 17:36
CHANGE text in button on sheet
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78474
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: CHANGE text in button on sheet
Your code loops through the records, but in your instruction #2, you "loop" through the fields of a record. What exactly do you want? How many records does the recordset have, and how many fields?
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4355
- Joined: 26 Apr 2010, 17:36
Re: CHANGE text in button on sheet
sorry me, only one fileds with three values.HansV wrote:Your code loops through the records, but in your instruction #2, you "loop" through the fields of a record. What exactly do you want? How many records does the recordset have, and how many fields?
-
- Administrator
- Posts: 78474
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: CHANGE text in button on sheet
Code: Select all
Dim i As Long
Do Until RS1.EOF
i = i + 1
ActiveSheet.Buttons("Button " & i).Caption = RS1.Fields(0).Value
RS1.MoveNext
Loop
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4355
- Joined: 26 Apr 2010, 17:36
Re: CHANGE text in button on sheet
PERFECT!HansV wrote:Code: Select all
Dim i As Long Do Until RS1.EOF i = i + 1 ActiveSheet.Buttons("Button " & i).Caption = RS1.Fields(0).Value RS1.MoveNext Loop