Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

make Detail section into grid 1

Status
Not open for further replies.

THWatson

Technical User
Apr 25, 2000
2,601
CA
Using Access 2000

The user of this particular database would like the Detail section to appear as a grid...in other words, to have a fixed number of rows and columns, with enclosed borders like in an Excel spreadsheet, even though some of those rows and columns will be blank.

There are 7 columns of data for each row. Sometimes the query that populates the report will have 15 records (producing 15 rows), sometimes only 3 records (producing 3 rows)...but there is room in the Detail section for 30 rows. So the user would like the empty rows and columns to have boxed borders around the rows and columns, so that the page always has 30 rows, irrespective of how many of those rows actually have data entered in them.

If this can be done, can somebody give me a push in the right direction?

Thanks.

Tom
 
Assuming you have controls named text1 - text7 that have left and right sides matching your grid widths, you can use code in th On Page event of the report like:
Code:
Private Sub Report_Page()
    Dim intI As Integer
    Dim intJ As Integer
    Dim intHeight As Integer
    Dim intTop As Integer
    Dim intLeft As Integer
    Dim intWidth As Integer
    intHeight = Me.Detail.Height
    For intJ = 1 To 30
        For intI = 1 To 7
            intLeft = Me("text" & intI).Left
            intTop = intJ * intHeight
            intWidth = Me("text" & intI).Width
            Me.Line (intLeft, intTop)- _
                Step(intWidth, intHeight), , B
        Next
    Next
End Sub

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Duane
Thanks for the suggestion.

It ain't quite as simple as your example. The controls aren't named text1 through text7. They are Acct#, Description, PMT, COPAY, ADJ, DEDUCT and PatName.

In any event, I will see what I can do.

Tom
 
Tom,
You can rename your controls. Or place invisible control named line1-line7 adjacent to the tops of your text boxes.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Duane
Thanks. I renamed the controls, and things work like a charm.

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top