Hi, Everyone
I have developed a form with an option group. The option group caption are
dynamically obtained from a database, the caption length varies
dynamically, as does the size of the form depending on how many
options/captions are obtained from the database, the problem I am having
is when the caption text is short (i.e, approx 10 characters) the letters
wrap, but if the text is longer it is displayed correctly, any help will
be greately appreciated.
Peter
Here is the code:
intLeft = Me.optProject(0).Left
With optProject(0)
.Caption = rs!Project_Name
.Width = Len(.Caption) * 190
iWidest = .Width
.Value = True
End With
If rs.RecordCount = 1 Then GoTo CloseRS
rs.MoveNext
If Err > 0 Then GoTo CloseRS
x = 1
Do
Load Me.optProject(x)
With Me.optProject(x)
.Left = intLeft
.Top = optProject(x - 1).Top + 300
.Caption = rs!Project_Name
.Width = Len(.Caption) * 190
If .Width > iWidest Then iWidest = .Width
.Visible = True
.Value = False
.Enabled = True
End With
rs.MoveNext
x = x + 1
Loop While Not rs.EOF
CloseRS:
rs.Close
'resize form
With Me
.Width = iWidest + 1440
.Height = optProject(optProject.count - 1).Top + 1275
.Left = (Dbname.ScaleWidth - .Width) / 2
.Top = (Dbname.ScaleHeight - .Height) / 2
End With
'place command buttons
With cmdClose(0)
.Top = optProject(optProject.count - 1).Top + 400
.Left = Width / 2 - .Width / 2 - .Width
End With
With cmdClose(1)
.Top = cmdClose(0).Top
.Left = Width / 2 - .Width / 2 + .Width
End With
'set first option as default
optProject(0).Value = True
Show
End Sub