Msaccess错误代码 [英] Msaccess error code
问题描述
Me.LnDetBot.Top = TP
Me.LnDetBot.Top = Tp
在打开上述错误代码来报告。
On opening the report the above error code comes.
此错误来自一个报告有以下代码。 原始的db文件只有5列,而我已经增加到15列,发现上面的错误代码。
this error comes from a report having following code. The db file in original was having only 5 columns whereas I have increased to 15 columns found the above error code.
总代码如下:
私人小组ReportHeader_Format(取消作为整数,_
               &NBSP ;                        &NBSP ;
FormatCount As Integer)
On Error GoTo ErrTrap
Dim rst as DAO.Recordset
Dim Fnm As String,Lnm As String
Dim Tp As Long
'连续字段之间的垂直边距
Const Mgn As Long = 30
设置rst =表格("F_Main")("SF_Sub")。Form.RecordsetClone
如果rst.BOF则为
'Recorset已空_
GoTo ExitPoint
否则
rst.MoveFirst
结束如果是
'将细节高度设置为较大的值,以便为
'容纳最大可能的字段
Me.Detail.Height = 5000
'设置第一个字段顶部的初始值
Tp = 80
Do Until rst.EOF
'获得领域&标签名称为
Fnm = rst.Fields(" FieldName")
Lnm ="Lb" &安培; Fnm
'操纵字段的位置和可见性
'和标签,根据活动状态为
'由用户选择
如果rst.Fields(QUOT;活动")=真,那么
           我(Fnm).Visible = True
我(Lnm).Visible = True
我(Fnm).Top = Tp
我(Lnm).Top = Tp
Tp = Tp + Me(Fnm).Height + Mgn '(A)
否则为
我(Fnm).Visible = FUE
箱(LNM)。可见=假
           我(Fnm).Top = 0
我(Lnm).Top = 0
结束如果
rst.MoveNext
循环
'设置顶部位置 底线详细部分
'已经计算了适当的价值。
'根据声明(A)
Me.LnDetBot.Top = Tp
'将细节高度设置为零可确保为
'紧贴其内容
Me.Detail.Height = 0
退出点:
On Error Resume Next
rst。关闭
Set rst = Nothing
On Error GoTo 0
退出子
币
$
ErrTrap:
MsgBox Err.Number& " - " &安培;错误描述
恢复退出点
结束子
Private Sub ReportHeader_Format(Cancel As Integer, _
FormatCount As Integer)
On Error GoTo ErrTrap
Dim rst As DAO.Recordset
Dim Fnm As String, Lnm As String
Dim Tp As Long
' Vert margin between consequtive fields
Const Mgn As Long = 30
Set rst = Forms("F_Main")("SF_Sub").Form.RecordsetClone
If rst.BOF Then
' Recorset is empty
GoTo ExitPoint
Else
rst.MoveFirst
End If
' Set detail height to a large value so as to
' accomodate maximum likely fields
Me.Detail.Height = 5000
' Set initial value for top of first field
Tp = 80
Do Until rst.EOF
' Get field & label names
Fnm = rst.Fields("FieldName")
Lnm = "Lb" & Fnm
' Manipulate position and visibility of fields
' and labels, as per the Active status as
' selected by the user
If rst.Fields("Active") = True Then
Me(Fnm).Visible = True
Me(Lnm).Visible = True
Me(Fnm).Top = Tp
Me(Lnm).Top = Tp
Tp = Tp + Me(Fnm).Height + Mgn ' (A)
Else
Me(Fnm).Visible = False
Me(Lnm).Visible = False
Me(Fnm).Top = 0
Me(Lnm).Top = 0
End If
rst.MoveNext
Loop
' Set top position of bottom line in detail section
' Appropriate value has already been computed
' as per statement (A)
Me.LnDetBot.Top = Tp
' Setting detail height to zero ensures
' tight fit over its contents
Me.Detail.Height = 0
ExitPoint:
On Error Resume Next
rst.Close
Set rst = Nothing
On Error GoTo 0
Exit Sub
ErrTrap:
MsgBox Err.Number & " - " & Err.Description
Resume ExitPoint
End Sub
推荐答案
什么错误是你收到的确切(请说出号码和描述)?
What error are you receiving exactly (number and description please)?
当错误发生并且你调试时,Tp的值是多少?
When the error occurs and you debug, what is the value of Tp?
你的VBA吗?编译没有错误?
Does your VBA compile without errors?
这篇关于Msaccess错误代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!