Concatenating

  • Thread starter Thread starter Bob Rice
  • Start date Start date
B

Bob Rice

I need to have the controls (images) in the form, frmName evaluated to find
out which ones will be made visible. The names of the controls are
Image51X, Image51Z, Image52X, Image52Z, etc. The code needs to read:

Do While...
Forms![frmName].[??????].Visible = True
.MoveNext
Loop

I am unable to get the syntax correct to increment to image names.
 
If you've got the control name stored in a variable strControl, try:

Forms![frmName].Controls(strControl).Visible = True
 
Still can't get it.

site = 51X
Do While site = .[Site Name]
If (.[DateIn] >= indate And .[DateIn] < outdate) Or (.[DateIn] <
indate And .[DateOut] > indate) Then
'Forms![frm Park].[Image51X].Visible = True --- *****
This line works fine

goodtext = "Image" & site
Forms![frm Park].[goodtext].Visible = True
End If
.MoveNext
Loop



goodtext won't work. Trying "Forms![frmName].Controls(strControl).Visible =
True" won't do it either.

--
Bob Rice
www.geocities.com/arrice.geo
Douglas J. Steele said:
If you've got the control name stored in a variable strControl, try:

Forms![frmName].Controls(strControl).Visible = True



--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



Bob Rice said:
I need to have the controls (images) in the form, frmName evaluated to find
out which ones will be made visible. The names of the controls are
Image51X, Image51Z, Image52X, Image52Z, etc. The code needs to read:

Do While...
Forms![frmName].[??????].Visible = True
.MoveNext
Loop

I am unable to get the syntax correct to increment to image names.
 
Reread what I suggested.

Forms![frmName].Controls(strControl).Visible = True

In other words,

Forms![frm Park].Controls(goodtext).Visible = True

not

Forms![frm Park].[goodtext].Visible = True


--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



Bob Rice said:
Still can't get it.

site = 51X
Do While site = .[Site Name]
If (.[DateIn] >= indate And .[DateIn] < outdate) Or (.[DateIn] <
indate And .[DateOut] > indate) Then
'Forms![frm Park].[Image51X].Visible = True --- *****
This line works fine

goodtext = "Image" & site
Forms![frm Park].[goodtext].Visible = True
End If
.MoveNext
Loop



goodtext won't work. Trying "Forms![frmName].Controls(strControl).Visible =
True" won't do it either.

--
Bob Rice
www.geocities.com/arrice.geo
Douglas J. Steele said:
If you've got the control name stored in a variable strControl, try:

Forms![frmName].Controls(strControl).Visible = True



--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



Bob Rice said:
I need to have the controls (images) in the form, frmName evaluated to find
out which ones will be made visible. The names of the controls are
Image51X, Image51Z, Image52X, Image52Z, etc. The code needs to read:

Do While...
Forms![frmName].[??????].Visible = True
.MoveNext
Loop

I am unable to get the syntax correct to increment to image names.
 
Back
Top