automatic control width depending on text length

A

AccessMan

I would like to create a string of text in sentence form for display on a
report. The string consists of several fields of text data of varying
lengths that are concatenated together via bound report controls. I need to
format the individual controls dynamically based on their values. As an
example, I'll set the text color of a particular control to red if the bound
field value equals "ALERT". Within the displayed sentence I only want that
field value to be colored red. I can accomplish the above easily, but the
problem is I can't cause the control to automatically adjust in length
depending on the length of the text, which is necessary for the displayed
text to look like a normal sentence. The 'Can Grow' property causes a
too-narrow control to wrap to the next line which is not what I'm looking
for. I wish there were a 'Can Grow to the Right' and 'Can Grow Wrap'
properties.

Does anybody know how to accomplish this?

Thanks!!!
 
D

Duane Hookom

You might be able to use the Print method of the report. Assuming you have a
text box named ContactName in your report, you could have code like the
following.
Me.FontSize = 12
Me.CurrentX = Me.ContactName.Left
Me.CurrentY = Me.ContactName.Top
Me.Print "Subject: New sub-agreement "
Me.CurrentY = Me.ContactName.Top
Me.FontBold = True
Me.Print Me.ContactName
Me.FontBold = False
Me.CurrentY = Me.ContactName.Top
Me.Print " under the..."
End Sub
 

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