U
UnderGround
Hi,
I am using code in the Onformat event to assign values to a textbox
from a query. The problem i am having is that if i paste the same code
in the OnPrint method it works fine if you browse the pages in a
sequence but if you jump directly on the last page then the date will
be wrong. Only the first page is correct the rest have data duplicated
from the first page and showing wrong data for the records. If i use
the same code in the Onformat only the last page is correct (no matter
how i view it) and the last record is duplicated in all the records in
all the pages except the last page. I cant figure out whats going
wrong. Can anyone help Thanks.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If (Not rs.EOF) Then
If Me.FormatCount = 1 Then (***** I change this line to
Me.Printcount for the OnPrint method)
Me.txtName.Value = rs("[Name]")
Me.txtCompanyName.Value = rs("[Company Name]")
Me.txtABNNo.Value = rs("[ABN No]")
Me.txtACNNo.Value = rs("[ACN No]")
If (IsNull(rs("[Policy Expiry Date]"))) Then
Me.txtPolicyExpDate.Value = "NOT ENTERED"
Else
strPolicyExpDate = DateValue(rs("[Policy Expiry Date]"))
If (DateDiff("d", (DateAdd("d", 28, Date)), strPolicyExpDate) <
0) Then
Me.txtPolicyExpDate.Value = strPolicyExpDate
Else
Me.txtPolicyExpDate.Value = ""
End If
End If
If (IsNull(rs("[Public Liability Policy Expiry Date]"))) Then
Me.txtLiabilityExpDate.Value = "NOT ENTERED"
Else
strLaibilityExpDate = DateValue(rs("[Public Liability Policy
Expiry Date]"))
If (DateDiff("d", (DateAdd("d", 28, Date)),
strLaibilityExpDate) < 0) Then
Me.txtLiabilityExpDate.Value = strLaibilityExpDate
Else
Me.txtLiabilityExpDate.Value = ""
End If
End If
rs.MoveNext
End If
End If
End Sub
I am using code in the Onformat event to assign values to a textbox
from a query. The problem i am having is that if i paste the same code
in the OnPrint method it works fine if you browse the pages in a
sequence but if you jump directly on the last page then the date will
be wrong. Only the first page is correct the rest have data duplicated
from the first page and showing wrong data for the records. If i use
the same code in the Onformat only the last page is correct (no matter
how i view it) and the last record is duplicated in all the records in
all the pages except the last page. I cant figure out whats going
wrong. Can anyone help Thanks.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If (Not rs.EOF) Then
If Me.FormatCount = 1 Then (***** I change this line to
Me.Printcount for the OnPrint method)
Me.txtName.Value = rs("[Name]")
Me.txtCompanyName.Value = rs("[Company Name]")
Me.txtABNNo.Value = rs("[ABN No]")
Me.txtACNNo.Value = rs("[ACN No]")
If (IsNull(rs("[Policy Expiry Date]"))) Then
Me.txtPolicyExpDate.Value = "NOT ENTERED"
Else
strPolicyExpDate = DateValue(rs("[Policy Expiry Date]"))
If (DateDiff("d", (DateAdd("d", 28, Date)), strPolicyExpDate) <
0) Then
Me.txtPolicyExpDate.Value = strPolicyExpDate
Else
Me.txtPolicyExpDate.Value = ""
End If
End If
If (IsNull(rs("[Public Liability Policy Expiry Date]"))) Then
Me.txtLiabilityExpDate.Value = "NOT ENTERED"
Else
strLaibilityExpDate = DateValue(rs("[Public Liability Policy
Expiry Date]"))
If (DateDiff("d", (DateAdd("d", 28, Date)),
strLaibilityExpDate) < 0) Then
Me.txtLiabilityExpDate.Value = strLaibilityExpDate
Else
Me.txtLiabilityExpDate.Value = ""
End If
End If
rs.MoveNext
End If
End If
End Sub