Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bolding "Part" of a field

Status
Not open for further replies.

CharlieT302

Instructor
Mar 17, 2005
406
US
Hi Folks,

I have an interesting request. I have a drop-down (combo) box that displays identification numbers for projects. It was requested that we make bold only one part of the field so that, when the user opens the combo box, the bolded part of each value stands out.

To add to the dilemma is that the bolding may start either 8 or 9 digits from the right-side and continue to the end.

Ideas?

 
I would think that the only way you could fake this would be to use a continuous subform and format it to "act" like a combo box. With a subform you can use a richtext textbox and use a calculated field to put in the tags. Format the subform to be the same size as a textbox. Place the subform behind the textbox. Put a fake down arrow next to the text box (image). Click on the textbox and make the subform grow to a specify size. When the value of the subform changes shrink it back. Synch the subform value with the textbox value.

Even if you would use a listview, you are still limited to format each row not within a row.
 
This can be faked pretty well. Here is what it looks like.
2qwpois.jpg


That is a textbox with a hidden "shrunk subform" and a command button to look like a down arrow.
The code is something like this.

Code:
Private WithEvents subfrm As Access.Form
Private subFrmCtl As Access.SubForm

Private Sub cmdDown_Click()
  GrowForm
End Sub

Private Sub Form_Load()
  Set subFrmCtl = Me.subfrmEmployees
  Set subfrm = Me.subfrmEmployees.Form
  subFrmCtl.Height = 0
  subFrmCtl.Visible = False
  subfrm.OnCurrent = "[Event Procedure]"
End Sub
Private Sub subfrm_Exit(Cancel As Integer)
  ShrinkForm
End Sub

Public Sub GrowForm()
  subFrmCtl.Height = 2 * 1440
  subFrmCtl.Visible = True
End Sub

Private Sub ShrinkForm()
  subFrmCtl.Height = 0
  Me.Text9.SetFocus
  subFrmCtl.Visible = False
End Sub
Private Sub subfrm_Current()
   Me.Text9 = subfrm.FullNameNoFormat
   ShrinkForm
End Sub

The sql for the subform was
Code:
SELECT 
 Employees.ID, 
 [LastName] & ",  <strong>" & [FirstName] & "</strong>" AS FullName, 
 [LastName] & ", " & [FirstName] AS FullNameNoFormat 
FROM 
 Employees;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top