Hi,
Been playing with the Can Grow/Shrink settings without much luck. Do they work as the names suggest?
I get scrollbars, v & h, without any resizing of the subform.
Thanks - Kirk
Hi Shane,
Thanks... I ignored 'print' and didn't know what 'preview' meant! Looks like can grow/shrink isn't the way to go.
I've tried to set a new height depending on the number of rows required (between 4 and 8) but ran into a wee problem. This is a subform and the problem line is :-
Forms!frmTracks.Height = "1.8cm"
Invokes this error :
Run-time error '2450':
Microsoft Access can't find the form 'frmTracks' referred to in a macro expression or Visual Basic code. * The form you referenced may be closed or may not exist in this database.
I don't think it's closed... is there a different syntax for setting a sub form property ?
Thanks - Kirk
Hi Shane,
Yes frmTracks is the subform name. The properties are
_ Subform/Subreport: frmTracks
All
Name . . . . . . . . . . . frmTracks
Source Object . . . . . frmTracks
Link Child Fields . . . . Cat
Link Master Fields . . . Cat
Status Bar Text . . . .
Visible . . . . . . . . . . . Yes
Display When . . . . . . Always
Enabled . . . . . . . . . . Yes
Locked . . . . . . . . . . No
Tab Stop . . . . . . . . . Yes
Tab Index . . . . . . . . 6
Can Grow . . . . . . . . Yes
Can Shrink . . . . . . . . Yes
Left . . . . . . . . . . . . 0.989cm
Top . . . . . . . . . . . . 5.998cm
Width . . . . . . . . . . . 13.199cm
Height . . . . . . . . . . . 3.6cm
Special Effect . . . . . . Sunken
Border Style . . . . . . . Solid
Border Width . . . . . . Hairline
Border Color . . . . . . 0
Tag . . . . . . . . . . . .
On Enter . . . . . . . . .
On Exit . . . . . . . . . .
I've tried Forms!frmTracks.Form.Height but it brings up the same error.
Can you suggest anything else?
Thanks - Kirk
Yes - from the 'Current' event, like so
--
Private Sub Form_Current()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb()
Dim sql$
sql$ = "SELECT Tracks.Cat FROM Tracks WHERE (((Tracks.Cat)="
sql$ = sql$ & Chr$(34) & Me.Text1 & Chr$(34) & "));"
Set rst = db.OpenRecordset(sql$)
rst.MoveLast
Select Case rst.RecordCount
Case 4
'Forms!frmTracks.Height = "1.8cm"
Case 8
Forms!frmTracks.Form.Height = "1.8cm"
Case Else
Stop
End Select
rst.Close
db.Close
Set rst = Nothing
Set db = Nothing
End Sub
--
Hi Shane,
Still in the woods. I think the value should be in twips, not "1.8cm" so I used this syntax:
Forms!Form1!frmTracks.Form.Height = 1440
which gave me
Run-time error '2465':
Application-defined or object-defined error
And I can't quite figure (from Help) what the error means.
Might just have to leave it a fixed Height. Relunctantly
Cheers - Kirk
Hi Shane,
We're there! Solved. But very odd... the syntax that works is just
frmTracks.Height =
Anything else causes an error. I got these by adding a temp button that showed the current height via a msgbox, then just tried a zillion things until it worked.
Thanks a million for all the help.
Cheers - Kirk