variable formatting within a field

  • Thread starter Thread starter dmeyer_06333
  • Start date Start date
D

dmeyer_06333

Guest
I have a database of scientific literature references. In a report, I would like to create a single wrapping field that combines several database fields (title, authors, journal, etc.), with variable formatting. For example, I want the journal name to be italics, title to be bold, etc.
 
I don't think this is possible using the standard form/report controls as the formatting always applies to the control, rather than parts of the control's value (part of the text within a text box for example).

It may be, however that there is a replacement control that can be added in, but I haven't managed to find anything like it.

Mike
 
I have been trying to do something similar.

I know you can do it for regular formats like changing a date from 06/01/01 to June 2001 or George to GEORGE. I am trying to find out if you can do it for BOLD and ITALICS - these visual ones seem harder.

I did (Format[Name], " (formating code here)" and then did the concatengation bit like & " " & (Format[Address], "formating code")) well something like that anyway. you just help format...
 
Storing all those different pieces of information in the same field is a poor design choice that will come back to haunt you (or your successor). You need to do some reading on table normalization.
 
Of course these are separate database fields. I want a report field in which they are concatenated with variable formatting. Can do?
 
As was suggested earlier by Mike, you need a Rich Text box control. There is no built in control that will do what you want. You can alter the format of a standard text box control with VBA but the formatting applies to ALL text in the control.

Stephania,
me.YourControlName.FontItalic = True
me.YourControlName.FontBold = True

If you type me.YourControlName. in the form's code module, you'll see a list of properties for that control. This properties list is one of the advantages of using the dot (.) rather than the bang (!) syntax.
 
Select Case ([Purpose])
Case Is = "CONS"
MyText = ((Format([Town], ">")) & " Openland" & " " & [Blurps] & " " & (Format([DateClosed], "(mmmm yyyy)")))
Case Is = "FOR"
MyText = ((Format([Town], ">")) & " Forestland" & " " & [Blurps] & " " & (Format([DateClosed], "(mmmm yyyy)")))
Case Is = "HIST"
MyText = ((Format([Town], ">")) & " Historical Significance" & " " & [Blurps] & " " & (Format([DateClosed], "(mmmm yyyy)")))
Case Is = "NAT"
MyText = ((Format([Town], ">")) & " Natural Resources" & " " & [Blurps] & " " & (Format([DateClosed], "(mmmm yyyy)")))
Case Is = "REC"
MyText = ((Format([Town], ">")) & " Recreation Area" & " " & [Blurps] & " " & (Format([DateClosed], "(mmmm yyyy)")))
Case Is = "WATER"
MyText = ((Format([Town], ">")) & " Water Resources" & " " & [Blurps] & " " & (Format([DateClosed], "(mmmm yyyy)")))
Case Is = "FARM"
MyText = ((Format([Town], ">")) & " " & [FarmType] & " Farm" & " " & [Blurps] & " " & (Format([DateClosed], "(mmmm yyyy)")))
Case Else
MyText = [Purpose]

End Select
End Sub

Where do I get to put this me.Town.FontBold=True and
me.Purpose.FontItalic=True

Thanks.

Stephania
 
Add a new variable:
Dim SetFont as Boolean
SetFont = True
Select Case ([Purpose])
Case Is = "CONS"
...
...
Case Else
MyText = [Purpose]
SetFont = False
End Select

If SetFont Then
me.YourControl.FontBold = True
me.YourControl.FontItalic = False
Else
me.YourControl.FontBold = False
me.YourControl.FontItalic = True
End If

End Sub
 

Users who are viewing this thread

Back
Top Bottom