Dynamic textboxes on a report - possible?

ozinm

Human Coffee Siphon
Local time
Today, 20:12
Joined
Jul 10, 2003
Messages
121
Hi all,
I was wondering if it was possible to create textboxes on the fly in a report using code.

Something like this:

Dim YearMatrix(1 To 31, 1 To 12) As TextBox

Private Sub Report_Open(Cancel As Integer)
Dim x, y As Integer
For x = 1 To 31
For y = 1 To 12
Set YearMatrix(x, y).Left = x
Set YearMatrix(x, y).Top = y
Set YearMatrix(x, y).Width = 1
Set YearMatrix(x, y).Height = 1
Set YearMatrix(x, y).Visible = True
Set YearMatrix(x, y).Border = 1
Next y
Next x
End Sub

As you may have guessed I'm looking for a quick way to draw up a year calendar that I can populate with text on the fly.

Am I on the right track - or do I need something completelty different?

Any help/ideas greatfully received.

PS I'm not looking for any pre-written code - I'd like to konw how to do it rather than just leaching.

TTFN

Marc;)
 
Put your formatting code in the report's Detail (section) OnFormat event.
 
Just tried it.
Keep getting the following error:
Statement invalid outside Type block
The expression may not result in the name of a macro, the name of a user-defined fuinction, or [Event Procedure].
There may have been an error evaluating the function, event, or macro.
I think there be something else I have to do create textboxes at run time to tie them in to Access.

However I can't find any information on the subject and there doesn't seem to be a method to create/add/copy an instance of a textbox in code.

Does someone know if this is possible?

I know it can be done in VB 6.0 but I'm not that familliar with access.

All help greatly apricated.

TTFN

Marc
 
Since you would normally only display records for dates entered in your db then you can create a calendar style report with just 5 textboxes and one subreport linked to each textbox, provided your child master fields are setup correctly, you may have to alter the number of textboxes depending on the style of your report.
 
I think I get you. However I'll need more than 5 boxes.
what I'm looking to produce is a year calendar that looks roughly like the attached jpeg.
 

Attachments

  • cal1.jpg
    cal1.jpg
    96.3 KB · Views: 212
Yes, it depends on the width of the textboxes you have, margins and orientation, just add the amount you require.
It is fiddly though
 
Nailed it!

I trawled through the help and found Me.Properties(x)

What I did in the end was create 12*31 textboxes in a form (not a report)
and used a FOR loop to set the content and background colour of each one on the fly.

If I get some time I'll make a demo and upload it.

TTFN

Marc
 

Users who are viewing this thread

Back
Top Bottom