感觉用html也不错作者: 付谦 时间: 2021-5-24 12:27
用word作太复杂了,用ACCESS作简单多了,我是这样考虑的:
1.、在原数据表上增加行数、排行、分页、下页行四个字段,用程序按每页每世26行计算分别为其赋值。
2、ACCESS不支持在报表上添加动态控件,采用笨办法在每世页两边添加28个文本框,(一人3个,分别是关系、姓名、综合框,,并用字母&世代&排行命名),还有一个文本框是为上页转下页行准备的,因每页只能容纳26行,姓名1人占2行,因此充其量每世只能9人,文本框宽设成线形,不然容不下,,高与上边距是固定的,,只有左边距与宽度在程度中动态设定.。采用复制,制作上百文本框也不费劲。
3、ASLXT大师此前的变量文本框语句使我的编程大大简化,经测试速度快省事,其他不细说,见程序
Private Sub 主体_Format(Cancel As Integer, FormatCount As Integer)
Dim rs9 As New ADODB.Recordset
Dim ssql9 As String
Dim i9, FF, KK, EE, YY As Long
Dim C9, MM As String
Dim DD1, DD2 As String
Dim NN, LB, LD, TF, TY, VY As Long
Dim PP, LP As Integer
i9 = 1
ssql9 = "select * from 谱树临时表 where 分页=1 OR 下页行>0 ORDER BY 世代,排行 " ''OR 下页行>0
rs9.Open ssql9, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
NN = 8634 '每世排行一姓名左边框,单位为缇
LP = 1530
TY = 0
For i9 = 1 To CLng(rs9.RecordCount)
FF = rs9!排行
MM = rs9!综合
TF = rs9!行数
LD = rs9!下页行
If rs9!世代 <= 6 Then
EE = rs9!世代
Else
EE = IIf(rs9!世代 Mod 5 = 0, 5, rs9!世代 Mod 5)
End If
If rs9!关系 Like "之[妣,配,子,女]" Then
DD1 = " " & Right(rs9!关系, 1)
ElseIf rs9!关系 Like "*[妣,配]" Then
DD1 = rs9!关系
LB = 0
Else
DD1 = Right(rs9!承上人, 2) & rs9!关系
LB = 70
End If
If Len(rs9!姓名) = 1 Then
DD2 = " " & Right(rs9!姓名, 1)
Else
DD2 = Right(rs9!姓名, 2)
End If
KK = EE & FF ''世代与排行
If EE < 6 And FF < 10 Then
If FF = 0 Then
PP = LD
Me.Controls("textT" & EE & 0).Left = NN - LD * 327 + LP
Me.Controls("textT" & EE & 0).Width = LD * 327
If TF = LD Then
If TF - LD = 0 Then Me.Controls("textT" & EE & 0) = MM
Else
If TF - LD > 0 Then Me.Controls("textT" & EE & 0) = Mid(MM, (TF - LD) * 8, 150)
End If
End If
PP = 0
If FF > 0 Then
Me.Controls("textU" & KK).Width = 576
Me.Controls("textP" & KK).Width = 654
Me.Controls("textT" & KK).Width = TF * 327 ''每行宽326缇
If FF = 1 Then
TY = 0
VY = FF * 2
Me.Controls("textP" & KK).Left = NN - (VY + PP) * 327 + LP - 5
Me.Controls("textU" & KK).Left = NN - (VY + PP) * 327 + LP + 40
Me.Controls("textT" & KK).Left = NN - (TF + VY + PP) * 327 + LP
TY = TF
Else
Me.Controls("textP" & KK).Left = NN - (TY + PP + FF * 2) * 327 + LP
Me.Controls("textU" & KK).Left = NN - (TY + PP + FF * 2) * 327 + LP + LB
TY = TY + TF
If LD > 0 Then
If LD = TF Then
Me.Controls("textT" & KK).Width = 0
Me.Controls("textT" & KK).Left = NN - (TY + PP + FF * 2 - TF) * 327 + LP
Else
Me.Controls("textT" & KK).Width = (TF - LD) * 327
Me.Controls("textT" & KK).Left = NN - (TY + PP + FF * 2 - LD) * 327 + LP
End If
Else
Me.Controls("textT" & KK).Left = NN - (TY + PP + FF * 2) * 327 + LP
End If
End If
Me.Controls("textT" & KK) = Mid(MM, 1, (TF - LD) * 8)
Me.Controls("textU" & KK) = DD1
Me.Controls("textP" & KK) = DD2
End If
End If
rs9.MoveNext
Next
rs9.Close
Set rs9 = Nothing
End Sub 作者: 付谦 时间: 2021-5-24 13:28
If rs9!世代 <= 6 Then 应是 If rs9!世代 <=5 Then