📄 data_process.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form Data_Process
BorderStyle = 1 'Fixed Single
Caption = "数据处理"
ClientHeight = 7995
ClientLeft = 45
ClientTop = 435
ClientWidth = 11880
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 7995
ScaleWidth = 11880
StartUpPosition = 2 '屏幕中心
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "Data_Process.frx":0000
Height = 6255
Left = 240
TabIndex = 2
Top = 720
Width = 11415
_ExtentX = 20135
_ExtentY = 11033
_Version = 393216
AllowUpdate = 0 'False
AllowArrows = 0 'False
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.Frame Frame1
Height = 7935
Left = 120
TabIndex = 0
Top = 0
Width = 11655
Begin MSAdodcLib.Adodc Adodc1
Height = 350
Left = 120
Top = 7000
Width = 11415
_ExtentX = 20135
_ExtentY = 609
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 = 0
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = ""
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 MSComctlLib.ProgressBar ProgressBar1
Height = 375
Left = 120
TabIndex = 8
Top = 7440
Width = 5300
_ExtentX = 9340
_ExtentY = 661
_Version = 393216
Appearance = 0
Scrolling = 1
End
Begin VB.CommandButton cmdClose
Caption = "关闭"
Height = 375
Left = 10440
TabIndex = 7
Top = 7440
Width = 1000
End
Begin VB.CommandButton cmdShowAll
Caption = "显示全部"
Height = 375
Left = 6120
TabIndex = 6
Top = 7440
Width = 1000
End
Begin VB.CommandButton cmdInAll
Caption = "全部导入"
Height = 375
Left = 9360
TabIndex = 5
Top = 7440
Width = 1000
End
Begin VB.CommandButton cmdInNow
Caption = "导入当前"
Height = 375
Left = 8280
TabIndex = 4
Top = 7440
Width = 1000
End
Begin VB.CommandButton cmdCheck
Caption = "核对数据"
Height = 375
Left = 7200
TabIndex = 3
Top = 7440
Width = 1000
End
Begin VB.Label Lb_JD
Alignment = 2 'Center
Height = 255
Left = 5400
TabIndex = 9
Top = 7500
Width = 735
End
Begin VB.Label Label2
Caption = "导入数据处理"
Height = 255
Left = 120
TabIndex = 1
Top = 240
Width = 2055
End
End
End
Attribute VB_Name = "Data_Process"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private InDB As New ADODB.Connection
Private InRS As New ADODB.Recordset
Private InDB_Open As Boolean
Private NowDB As New ADODB.Connection
Private NowRs As New ADODB.Recordset
Private NowDB_Open As Boolean
Private Fs As New FileSystemObject
Private NotInCondtion As String '保存not in条件
Private Sub Adodc1_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
If InRS.RecordCount = 0 Then
Adodc1.Caption = "第0条,共0条"
Else
Adodc1.Caption = "第" & InRS.AbsolutePosition & "条,共" & InRS.RecordCount & "条"
End If
End Sub
Private Sub cmdCheck_Click()
Dim TmpRs As New ADODB.Recordset
ProgressBar1.Value = 0
Set InRS = Nothing
InRS.Open "select * from Client_BASE", InDB, adOpenStatic, adLockOptimistic
Set Adodc1.Recordset = InRS
Set NowRs = Nothing
NowRs.Open "select * from Client_BASE", NowDB, adOpenStatic, adLockOptimistic
Set Adodc1.Recordset = InRS
If InRS.RecordCount <> 0 Then
InRS.MoveFirst
ProgressBar1.Max = InRS.RecordCount
While Not InRS.EOF
Lb_JD.Caption = InRS.AbsolutePosition & "/" & InRS.RecordCount
Set TmpRs = Nothing
TmpRs.Open "select * from Client_BASE where 客户名称='" & InRS!客户名称 & "'", NowDB, adOpenStatic, adLockOptimistic
If TmpRs.RecordCount = 0 Then
If NotInCondtion = "" Then
NotInCondtion = NotInCondtion & "'" & InRS!客户名称 & "'"
Else
NotInCondtion = NotInCondtion & ",'" & InRS!客户名称 & "'"
End If
End If
InRS.MoveNext
ProgressBar1.Value = ProgressBar1.Value + 1
Wend
InRS.MoveFirst
End If
If NotInCondtion <> "" Then
Set InRS = Nothing
InRS.Open "select * from Client_BASE where 客户名称 in (" & NotInCondtion & ")", InDB, adOpenStatic, adLockOptimistic
Set Adodc1.Recordset = InRS
MsgBox "导入数据中有" & InRS.RecordCount & "条数据在本地数据库中不存在", vbInformation, "信息提示"
cmdInNow.Enabled = True
cmdInAll.Enabled = True
Else
MsgBox "导入数据中的所有数据在本地数据库中存在,但其相关信息不一定正确,请自行核对", vbInformation, "信息提示"
End If
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdShowAll_Click()
Set InRS = Nothing
InRS.Open "select * from Client_BASE", InDB, adOpenStatic, adLockOptimistic
Set Adodc1.Recordset = InRS
End Sub
Private Sub Form_Activate()
If Fs.FileExists(App.Path & "\indata\InDB.mdb") Then
Set InDB = New ADODB.Connection
InDB.CursorLocation = adUseClient
InDB.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & App.Path & "\indata\InDB.mdb" & ""
InDB_Open = True
Set InRS = Nothing
InRS.Open "select * from Client_BASE", InDB, adOpenStatic, adLockOptimistic
Set Adodc1.Recordset = InRS
cmdInNow.Enabled = False
cmdInAll.Enabled = False
Else
cmdShowAll.Enabled = False
cmdCheck.Enabled = False
cmdInNow.Enabled = False
cmdInAll.Enabled = False
MsgBox "导入数据不存在", vbExclamation, "警告"
End If
End Sub
Private Sub Form_Load()
NotInCondtion = ""
Set NowDB = New ADODB.Connection
NowDB.CursorLocation = adUseClient
NowDB.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DataBasePath & ""
NowDB_Open = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
MDIForm1.Enabled = True
If NowDB_Open Then
NowDB.Close
End If
If InDB_Open Then
InDB.Close
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -