Aligning fields in combo box expression

J

John F

I want two fields to show in a combo box when the combo box is not selected.
To do this I created an expression consisting of both fields with spaces
concatonated in beween.

The first field has a variable number of characters, but I can vary the
number spaces to accommodate this. When the combo box is selected the second
fields do not line up when using proportional fonts. The proportional fonts
such as Courier look out of place on the form.

Any suggestions how to deal with this?

Thanks,

John
 
J

John F

I am familiar with trim() but that is not the point here. The issue is not
the number of characters, but the variation in spacing resulting from
proportional fonts.
 
D

Damon Heron

If this is really important to you, then you could do this:
Add a textbox over the area in the combobox, setting its visible false,
locked true, transparent border
Forgetting the concatonation for a sec, if you have two columns of text
(zero and 1), then in the after-update event of the combobox:

Private Sub Combo1_AfterUpdate()
Me.txtCol1.Visible = True
Me.txtCol1 = Me.Combo1.Column(1)
Me.txtCol1.SetFocus
Me.txtCol1.SelStart = 10
End Sub
The second part of the combo will always be aligned correctly, because it is
really a textbox!

Damon
 
J

John F

Hi Damon,

That's pretty cleaver, thanks. I think before doing that I will wait until
the app is finished and then decide if and what to do.

John
 

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