📄 form4.frm
字号:
Width = 1695
_ExtentX = 2990
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc Adodc2
Height = 330
Left = 2040
Top = 120
Visible = 0 'False
Width = 1695
_ExtentX = 2990
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc2"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Height = 855
Left = 240
TabIndex = 12
Top = 7680
Width = 2535
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "开始日期"
Height = 255
Index = 10
Left = 240
TabIndex = 11
Top = 840
Width = 735
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "结束日期"
Height = 255
Index = 9
Left = 240
TabIndex = 10
Top = 1200
Width = 735
End
End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim n(0 To 17)
On Error Resume Next
CommonDialog1.CancelError = False ' "选定主数据库"
CommonDialog1.Filter = "文本文件(*.txt)|*.txt"
CommonDialog1.ShowOpen
AB = CommonDialog1.FileName
If Len(AB) > 1 Then
ab1 = CommonDialog1.FileTitle
AB = Mid(AB, 1, Len(AB) - Len(ab1) - 1)
ab1 = Mid(ab1, 1, Len(ab1) - 4)
Data1.DatabaseName = AB
Data1.RecordSource = ab1
Data1.Refresh
For I = 0 To 17
n(I) = Data1.Recordset.Fields(I).Name
Next I
DataGrid1.Height = DataGrid1.Height - 2400
DataGrid1.Top = DataGrid1.Top + 2300
Grid1.Visible = True
Grid1.Width = DataGrid1.Width
If n(0) = "记录号" And n(1) = "记录时间" And n(2) = "用户姓名" And n(3) = "电话1" And n(4) = "电话2" And n(5) = "电话3" _
And n(6) = "邮编" And n(7) = "地址" And n(8) = "产品类型" And n(9) = "产品型号" And n(10) = "收费记录" _
And n(11) = "投诉性质" And n(12) = "接线员" And n(13) = "处理人" And n(14) = "反映情况" And n(15) = "处理记录" _
And n(16) = "跟踪情况" And n(17) = "处理时间" Then
Command4.Enabled = True
Else
MsgBox "您选择的记录与本程序数据库规则不符!", , "错误"
End If
End If
End Sub
Private Sub Command4_Click()
On Error Resume Next
Data1.Recordset.MoveFirst
S1 = 0
S2 = 0
Do While Data1.Recordset.EOF = False
Adodc2.RecordSource = "SELECT * FROM fw1 WHERE 记录时间=#" & Format(Data1.Recordset(1), "yyyy-mm-dd") & "# and 用户姓名='" & Data1.Recordset(2) & "' and 电话1='" & Data1.Recordset(3) & "' and 地址='" & Data1.Recordset(7) & "'and 产品型号='" & Data1.Recordset(9) & "' and 接线员='" & Data1.Recordset(12) + "'"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount = 0 Then
Adodc1.Recordset.AddNew
For X = 1 To Data1.Recordset.RecordCount
Adodc1.Recordset.Fields(X) = Data1.Recordset(X)
Next X
Adodc1.Recordset.Update
S1 = S1 + 1
Else
S2 = S2 + 1
End If
Data1.Recordset.MoveNext
Loop
Adodc1.Refresh
If S2 = 0 Then
MsgBox "共导入" & S1 & "条记录。", , "数据导入"
Else
MsgBox "共导入" & S1 & "条记录,有" & S2 & "条记录没有导入数据库,原因可能是该条记录已在数据库存在。", , "数据导入"
End If
Command4.Enabled = False
End Sub
Private Sub Command2_Click()
On Error Resume Next
CommonDialog1.CancelError = False ' "选定主数据库"
CommonDialog1.Filter = "文本文件(*.txt)|*.txt"
CommonDialog1.ShowSave
ap = CommonDialog1.FileName
Adodc2.RecordSource = Adodc1.RecordSource
Adodc2.Refresh
Open ap For Output As 1
a = Adodc2.Recordset.Fields.Count
For I = 0 To a - 2
Print #1, Adodc2.Recordset(I).Name; ", "; ' 不换行
Next I
Print #1, Adodc2.Recordset(a - 1).Name
Adodc2.Recordset.MoveFirst
Do While Not Adodc2.Recordset.EOF
For I = 0 To a - 2
Print #1, Adodc2.Recordset(I); ", "; ' 不换行
Next I
Print #1, Adodc2.Recordset(a - 1)
Adodc2.Recordset.MoveNext
Loop
Close
Command2.Enabled = False
End Sub
Private Sub Command3_Click()
If DTPicker1.Enabled = True Then
a1 = "处理时间=#" & Format(DTPicker1, "yyyy-mm-dd") & "#"
End If
If DTPicker2.Enabled = True Then
a1 = "处理时间>=#" & Format(DTPicker1, "yyyy-mm-dd") & "# and 处理时间<=#" & Format(DTPicker2, "yyyy-mm-dd") & "#"
End If
If Len(a1) > 5 Then
Adodc1.RecordSource = "SELECT * FROM fw1 WHERE " + a1
Else
Adodc1.RecordSource = "SELECT * FROM fw1"
End If
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Command2.Enabled = True
Else
Command2.Enabled = False
End If
End Sub
Private Sub Command5_Click()
DataGrid1.Height = DataGrid1.Height + 2400
DataGrid1.Top = DataGrid1.Top - 2300
Grid1.Visible = False
Command4.Enabled = False
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = acs
Adodc1.RecordSource = "fw1"
Adodc1.Refresh
Adodc2.ConnectionString = acs
End Sub
Private Sub Form_Resize()
If Me.Width > 3000 Then DataGrid1.Width = Me.Width - 480
If Me.Height > 3000 Then DataGrid1.Height = Me.Height - 2800
End Sub
Private Sub Option1_Click(Index As Integer)
If Index = 0 Then
DTPicker1.Enabled = False
DTPicker2.Enabled = False
ElseIf Index = 1 Then
DTPicker1.Enabled = True
DTPicker2.Enabled = False
ElseIf Index = 2 Then
DTPicker1.Enabled = True
DTPicker2.Enabled = True
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -