Dynamic Command Button Caption

G

gmcnaugh

Hi,

Hopefully someone can help me with this one. I have designed a number
of 'Prime' user forms which have a number of questions posed via
command buttons. The user simply 'pushes' the relevant buttons to
generate a text string dependent on the button pressed. Along with
the 'Prime' questions are a series of 'Generic' questions hosted on
another user form again using command buttons. On this 'generic' form
are a series of 'Prime' specific questions which obviously vary in
form and number dependant on 'Prime.' The number of specific
'generic' buttons is determined by VBA code in the 'Prime' form and
whilst I can get that to work ok I cannot generate the captions text
called ‘strLatch’ which is also generated in the 'Prime' coding. The
code on the 'generic form is shown below. I originally used
Checkboxes and TextBoxes to do this part but found that it was easier
for the user to enter data (using a touchscreen as the HMI) via big
CommandButtons. I have left some of the old code in to (hopefully)
demonstrate what I am trying to do here:

Public Sub UserForm_Initialize()
'Dim Titbox As String
Dim contBox As String
Dim qq As Integer
If intNoLatch = 0 Then GoTo Leap
For qq = 1 To intNoLatch
contBox = "CommandButton" & Format$(qq + 26)
'Titbox = "CommandButton" & Format$(qq + 26)
'Me.Controls(Titbox).Visible = True
Me.Controls(contBox).Visible = True
'Me.Controls(Titbox) = strLatch(qq)
Next qq
Leap:
End Sub

Many thanks in advance.

Slainte! (Cheers!)

Glen
 
M

Marshall Barton

Hopefully someone can help me with this one. I have designed a number
of 'Prime' user forms which have a number of questions posed via
command buttons. The user simply 'pushes' the relevant buttons to
generate a text string dependent on the button pressed. Along with
the 'Prime' questions are a series of 'Generic' questions hosted on
another user form again using command buttons. On this 'generic' form
are a series of 'Prime' specific questions which obviously vary in
form and number dependant on 'Prime.' The number of specific
'generic' buttons is determined by VBA code in the 'Prime' form and
whilst I can get that to work ok I cannot generate the captions text
called ‘strLatch’ which is also generated in the 'Prime' coding. The
code on the 'generic form is shown below. I originally used
Checkboxes and TextBoxes to do this part but found that it was easier
for the user to enter data (using a touchscreen as the HMI) via big
CommandButtons. I have left some of the old code in to (hopefully)
demonstrate what I am trying to do here:

Public Sub UserForm_Initialize()
'Dim Titbox As String
Dim contBox As String
Dim qq As Integer
If intNoLatch = 0 Then GoTo Leap
For qq = 1 To intNoLatch
contBox = "CommandButton" & Format$(qq + 26)
'Titbox = "CommandButton" & Format$(qq + 26)
'Me.Controls(Titbox).Visible = True
Me.Controls(contBox).Visible = True
'Me.Controls(Titbox) = strLatch(qq)
Next qq
Leap:
End Sub


Sorry, no help here. UserForms do nor play all that well in
Access. Access forms are generally much better rhan user
forms, so hardly anyone in this forum has any experience
using them.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top