Concatenating

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.
 
D

Douglas J. Steele

If you've got the control name stored in a variable strControl, try:

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

Bob Rice

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.
 
D

Douglas J. Steele

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.
 

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