I have a form with 30 buttons on it named cmd1, cmd2 and so on. They all have different Caption which is cost ID.
along with buttons I have display fields that holds the description of the corresponding button. However the description is captured from a table onLoad.
to get the description and display it I have:
tmpText = cmd1.Caption
Set rstSet = dbs.OpenRecordset("SELECT [Cost Id].Description FROM [Cost Id]WHERE ([Cost Id].CostID)='" & tmpText & "';"
rstSet.MoveFirst
Me![text1] = rstSet![Description]
for cmd2 is same as above with cmd2 substituted for cmd1 and so on.
I want to do all buttons in a while statement The problem is how do I get the contents of the variable
i=1
While i < 32
tmpCmd = Val("cmd" & i & ".Caption"????This returns cmd1.Caption not the caption on a button.
along with buttons I have display fields that holds the description of the corresponding button. However the description is captured from a table onLoad.
to get the description and display it I have:
tmpText = cmd1.Caption
Set rstSet = dbs.OpenRecordset("SELECT [Cost Id].Description FROM [Cost Id]WHERE ([Cost Id].CostID)='" & tmpText & "';"
rstSet.MoveFirst
Me![text1] = rstSet![Description]
for cmd2 is same as above with cmd2 substituted for cmd1 and so on.
I want to do all buttons in a while statement The problem is how do I get the contents of the variable
i=1
While i < 32
tmpCmd = Val("cmd" & i & ".Caption"????This returns cmd1.Caption not the caption on a button.