Full Version: Row Height
UtterAccess Discussion Forums > Microsoft® Access > Access Reports
eacollie
I'm trying to create a report that looks like a weekly calendar. Is there a way to display the lines around the days in the same row (Sunday - Saturday) short of drawing the lines in the form itself? Some days contain data and others do not; I've set the text field to "can grow." (I hope this makes sense)

Thanks for any help.
projecttoday
Can you describe your setup a little more? By text field do you mean textbox? How many are there? Why do they need to grow? Have you tried putting a border around them?
eacollie
Thanks projecttoday.

Yes, they are textboxes (7 across). They need to expand.

I've tried the border, but the border expands in only one textbox (if that textbox has expanded), and not in the other (unexpanded) text boxes. I don't like this look.

Any suggestions?

Thanks much!
RAZMaddaz
What you can do, is click on each of the Text Boxes, view the Properties and under the Format Tab, almost at the very bottom, change the Can Grow to "Yes".
eacollie
Thanks RazMaddaz.

All the text boxes are set to "can grow." However, the border doesn't "grow" uniformly for each row.

For example, if the text box in column 5 is expanded, but the other text boxes in the other columns of the same row have not (because there is either no text or not as much text), the border is smaller around these text boxes.

I'm trying to figure out how to make the border uniform over all text boxes in the same row.

Thanks!
RAZMaddaz
Have you tried double-clicking on the Detail border and then in the Property Sheet, change the Can Grow to "Yes" there?
eacollie
Thanks RazMaddaz.

I'm using Access 2007. I don't see a border for the detail section in the property sheet.

The "can grow" property for the detail section is set to true.
RAZMaddaz
QUOTE (eacollie @ Aug 8 2011, 10:38 AM) *
Thanks RazMaddaz.

I'm using Access 2007. I don't see a border for the detail section in the property sheet.

The "can grow" property for the detail section is set to true.



I'm sorry, the detail section was where I meant. Can you upload a copy of your file, WITHOUT ANY PRIVATE DATA and someone can take a took and give a suggestion on how to fix this?
rbianco
The issue you are encountering is that each day is it's own control, and each control will only "grow" as it needs to. So, if Sunday has a bunch of stuff and needs to grow it will, but if there is nothing on Monday, Monday will not grow. The only thing I can think to do is to find maximum height of the tallest control (at time of formatting) and apply that height to the other six days. To capture the required height in time for it to be "available" when the report is formatting is going to be the trickiest part.

You may need to play around with a few different approaches, but one that I can think of is to establish a 'MaxLength" field in the underlying query that feeds your calendar.

Place this code in an outside module:
CODE
Function MaxOfList(ParamArray varValues()) As Variant
    Dim i As Integer        'Loop controller.
    Dim varMax As Variant   'Largest value found so far.

    varMax = Null           'Initialize to null

    For i = LBound(varValues) To UBound(varValues)
        If IsNumeric(varValues(i)) Or IsDate(varValues(i)) Then
            If varMax >= varValues(i) Then
                'do nothing
            Else
                varMax = varValues(i)
            End If
        End If
    Next

    MaxOfList = varMax
End Function


Call it in your query like thus:
MyMaxLen: MaxOfList(Len(SunText),Len(MonText),Len(TueText),Len(WedText),Len(ThuText),Len(F
riText),Len(SatText))

The query will now hold an integer value representing the longest string. Now that the longest string is known play around with a few different height values like so:

Assuming you can add a Tag Value to your "CalendarDay" control boxes, you could do this in the OnFormat event of your report:

CODE
Dim MyReqHeight as integer
Dim ctl as Control

Select Case MyMaxLen
Case < 100  
MyReqHeight  = 720     '  1/2" tall - the minumum height, even if all calendar days are empty
Case >99 and <200
MyReqHeight  = 1440     '  1" tall
Case >199
Case >99 and <200
MyReqHeight  = 2880'  2" tall -  the maximum height permitted..
End Select

For Each ctl in Me.Controls
If ctl.Tag = "CalendarDayControl" then
ctl.height = MyReqHeight  
Next ctl
eacollie
Here it is....thanks so much!
RAZMaddaz
eacollie,

Take a look at this Form and see if you might like this instead of the Report.
eacollie
Wow! That looks great RAZmaddaz. I'll take a look at it more carefully.... Thank you so much!
RAZMaddaz
yw.gif

Awesome, glad I could help you!!!

FYI, I am going to busy the next few days, so if you have an additional question, you might want to create a new topic. Good luck with your database!!!

RAZMaddaz
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.