Report Problem

G

Guest

Hi! I created a report based on aquery.It has 5 fields.

DeliveryDate:, DeliveryAgreement#:, DeliveryCharges:, HandlingCharges:

Around these fields I created a rectangular box and in the rectangular box in between the fields I kept vertical lines to show the details in a Rectangular box format.

My problem here was: I want to display only 10 records per page and if the records were less than 10, lets say 5. I want to display those 5 records followed by 5 blank boxes.

Can Anyone help me!

Thanks
Vad
 
D

Duane Hookom

You should remove the box/rectangle/line controls and use the Line method to
draw all boxes. The following code will draw 24 horizontal lines that are
spaced the same as the height of the detail section. You can add a loop to
print the vertical lines. The last code below shows how to draw a complete
calendar on a page.

Private Sub Report_Page()
Dim intRows As Integer
Dim intLoop As Integer
Dim intTopMargin As Integer
intRows = 24
intDetailHeight = Me.Section(0).Height
intTopMargin = 360
For intLoop = 0 To intRows
Me.CurrentX = 20
Me.CurrentY = intLoop * intDetailHeight + intTopMargin
Me.Print intLoop + 1
Me.Line (0, intLoop * intDetailHeight + intTopMargin)-Step(Me.Width,
0)
Next
End Sub

Private Sub Report_Page()
Dim lngDayHeight As Long
Dim lngDayWidth As Long
Dim datRptDate As Date
Dim intStartWeek As Integer
Dim lngTopMargin As Long
Dim dat1stMth As Date
Dim datDay As Date
Dim lngTop As Long
Dim lngLeft As Long
datRptDate = Date
dat1stMth = DateSerial(Year(datRptDate), Month(datRptDate), 1)
intStartWeek = DatePart("ww", dat1stMth)
lngDayHeight = 2160 'one & half inch
lngDayWidth = 1440 'one inch
lngTopMargin = 720 'half inch
Me.FontSize = 22
'loop through all days in month
For datDay = dat1stMth To DateAdd("m", 1, dat1stMth) - 1
'find the top and left corner
lngTop = (DatePart("ww", datDay) - intStartWeek) * _
lngDayHeight + lngTopMargin
lngLeft = (Weekday(datDay) - 1) * lngDayWidth
If Weekday(datDay) = 1 Or Weekday(datDay) = 7 Then
Me.DrawWidth = 8
Else
Me.DrawWidth = 1
End If
'draw a rectangle for day
Me.Line (lngLeft, lngTop)-Step _
(lngDayWidth, lngDayHeight), , B
Me.CurrentX = lngLeft + 50
Me.CurrentY = lngTop + 50
Me.Print Day(datDay)
Next
End Sub
--
Duane Hookom
MS Access MVP


Vad said:
Hi! I created a report based on aquery.It has 5 fields.

DeliveryDate:, DeliveryAgreement#:, DeliveryCharges:, HandlingCharges:

Around these fields I created a rectangular box and in the rectangular box
in between the fields I kept vertical lines to show the details in a
Rectangular box format.
My problem here was: I want to display only 10 records per page and if the
records were less than 10, lets say 5. I want to display those 5 records
followed by 5 blank boxes.
 
G

Guest

Thanks for ur quick reply and the thing is I am not good at vb coding.Any way I will try with this. Am I going to get only horizontal lines only. or both horizontal and vertical lines also. Vertical Lines in the sense between fields, to like everything is in a box format.
Could u give the description next to each statement so that I can easily under stand the code.

Thanks
Vad



----- Duane Hookom wrote: -----

You should remove the box/rectangle/line controls and use the Line method to
draw all boxes. The following code will draw 24 horizontal lines that are
spaced the same as the height of the detail section. You can add a loop to
print the vertical lines. The last code below shows how to draw a complete
calendar on a page.

Private Sub Report_Page()
Dim intRows As Integer
Dim intLoop As Integer
Dim intTopMargin As Integer
intRows = 24
intDetailHeight = Me.Section(0).Height
intTopMargin = 360
For intLoop = 0 To intRows
Me.CurrentX = 20
Me.CurrentY = intLoop * intDetailHeight + intTopMargin
Me.Print intLoop + 1
Me.Line (0, intLoop * intDetailHeight + intTopMargin)-Step(Me.Width,
0)
Next
End Sub

Private Sub Report_Page()
Dim lngDayHeight As Long
Dim lngDayWidth As Long
Dim datRptDate As Date
Dim intStartWeek As Integer
Dim lngTopMargin As Long
Dim dat1stMth As Date
Dim datDay As Date
Dim lngTop As Long
Dim lngLeft As Long
datRptDate = Date
dat1stMth = DateSerial(Year(datRptDate), Month(datRptDate), 1)
intStartWeek = DatePart("ww", dat1stMth)
lngDayHeight = 2160 'one & half inch
lngDayWidth = 1440 'one inch
lngTopMargin = 720 'half inch
Me.FontSize = 22
'loop through all days in month
For datDay = dat1stMth To DateAdd("m", 1, dat1stMth) - 1
'find the top and left corner
lngTop = (DatePart("ww", datDay) - intStartWeek) * _
lngDayHeight + lngTopMargin
lngLeft = (Weekday(datDay) - 1) * lngDayWidth
If Weekday(datDay) = 1 Or Weekday(datDay) = 7 Then
Me.DrawWidth = 8
Else
Me.DrawWidth = 1
End If
'draw a rectangle for day
Me.Line (lngLeft, lngTop)-Step _
(lngDayWidth, lngDayHeight), , B
Me.CurrentX = lngLeft + 50
Me.CurrentY = lngTop + 50
Me.Print Day(datDay)
Next
End Sub
--
Duane Hookom
MS Access MVP


Vad said:
Hi! I created a report based on aquery.It has 5 fields.
in between the fields I kept vertical lines to show the details in a
Rectangular box format.records were less than 10, lets say 5. I want to display those 5 records
followed by 5 blank boxes.
 
D

Duane Hookom

With comments
Private Sub Report_Page()
'Set up the memory variables
'how many rows
Dim intRows As Integer
'to store current row within the loop
Dim intLoop As Integer
'forgot this in the original code
' stores height of detail section (space between lines)
Dim intDetailHeight as Integer
'store how far down on page to start lines
Dim intTopMargin As Integer
'how many lines to draw
intRows = 24
'this is the spacing of lines
intDetailHeight = Me.Section(0).Height
' set intTopMargin to fit your needs
intTopMargin = 360
'begin code to draw lines
For intLoop = 0 To intRows
'CurrentX sets the number of twips from the left margin
' a twip is 1/1440 of an inch
Me.CurrentX = 20
'CurrentY sets the distance from the top of the page
Me.CurrentY = intLoop * intDetailHeight + intTopMargin
'this next line prints the line number
Me.Print intLoop + 1
'the next line draws the line
Me.Line (0, intLoop * intDetailHeight +
intTopMargin)-Step(Me.Width,0)
Next
End Sub


--
Duane Hookom
Microsoft Access MVP


Vad said:
Thanks for ur quick reply and the thing is I am not good at vb coding.Any
way I will try with this. Am I going to get only horizontal lines only. or
both horizontal and vertical lines also. Vertical Lines in the sense between
fields, to like everything is in a box format.
 
D

Duane Hookom

I don't understand what you are asking. Do all deliveries entered on the
same date get the same Invoice#? I would never store the year and a unique
number in the same field.
Roger Carlson has some sample databases at his site
http://www.rogersaccesslibrary.com/TableOfContents2k.asp. At least one of
these shows how to create your own autonumber.

--
Duane Hookom
MS Access MVP


Vad said:
Thank u Very much for ur patience.
Hello sir I already posted this one in the groups. No one replied me for this.
Could u give me some help hand in this also.

I have DeliveriInformationTable which includes fields

DeliveryAgreement#(PK)
DeliveryDate---This is set to current date
DeliveryCharges
HandlingCharges
TotalInvoiceAmout
Invoice#

I have built a form based on the above table. What I am looking for is to
have the same Invoice number for the Delivery information entered on the
same date.
If I enter 10 delivery information, all those 10 must have the same
invoice number in a format like "CurrentYear""0000". It must start at the
above format. If it was next year again it must start at
"CurrentYear""0000".
 
G

Guest

Yes exactly. Allthe deliveries entered on the same date will have same invoice#. Is there any other way of doing that

What my boss asking me was, to have year folloed by a 4 digit number, like 20031023
For 2003 Invoice# should be like above
For 2004 Invoice# should be like2004345
And at the beginning of each year it must start at YYYY"0000

Ihave gone through the website u suggested. I didn't get any idea

Any Idea

Thank
Vad
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top