Hi,
You can get the width of a string with the API function
----------------------------------------------------------------------
Public Type Size
cx As Long
cy As Long
End Type
Declare Function GetTextExtentPoint32 Lib "gdi32" _
Alias "GetTextExtentPoint32A" ( _
ByVal hdc As Long, _
ByVal TheString As String, _
ByVal TheStringLength As Long, _ ' use: len(TheString)
TheSize As SIZE) As Long
--------------------------------------------------------------------------
(more details at AllAPI, as example). The width of the string is computed in
accordance with the default (selected) font of the supplied hDC... The
window of that control may not exists, in Access, so, you have to wait the
control is in focus, and thus, (probably) can get its hDC from GetDC
--------------------------------------------------------------------------
Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
---------------------------------------------------------------------------
supplying its then valid hWnd. Once you get the width of the string, in
TheSize.cx, you have to convert it in twips to then specify the combo box
width property.
Hoping it may help,
Vanderghast, Access MVP