📄 frmimport.frm
字号:
VERSION 5.00
Begin VB.Form frmimport_sec
BorderStyle = 1 'Fixed Single
Caption = "选择数据表"
ClientHeight = 3240
ClientLeft = 45
ClientTop = 330
ClientWidth = 4350
Icon = "frmimport_sec.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3240
ScaleWidth = 4350
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Cancel = -1 'True
Caption = "退出(&E)"
Height = 555
Left = 2790
TabIndex = 2
Top = 2220
Width = 1275
End
Begin VB.CommandButton Command1
Caption = "确定(&O)"
Default = -1 'True
Height = 555
Left = 2790
TabIndex = 1
Top = 1500
Width = 1275
End
Begin VB.ListBox List1
BackColor = &H00C0FFFF&
Height = 2580
Left = 150
TabIndex = 0
Top = 180
Width = 2325
End
End
Attribute VB_Name = "frmimport_sec"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cnn As ADODB.Connection
Dim cn As ADODB.Connection
Dim re As ADODB.Recordset
Dim sql As String
Private Sub Command1_Click()
On Error GoTo err
'**************根据用户所选择的数据表创建数据表*****************
Set db = opendatabase(database_data)
Set td = New TableDef
td_name = List1.Text
td.name = td_name
Set f1 = td.CreateField("记录号", dbInteger, 4)
td.Fields.Append f1
Set f2 = td.CreateField("编号", dbText, 8)
td.Fields.Append f2
Set f3 = td.CreateField("姓名", dbText, 10)
td.Fields.Append f3
Set f4 = td.CreateField("医药费", dbCurrency, 5)
td.Fields.Append f4
Set f5 = td.CreateField("类别", dbText, 2)
td.Fields.Append f5
Set f6 = td.CreateField("医生", dbText, 2)
td.Fields.Append f6
Set f7 = td.CreateField("自负金", dbCurrency, 5)
td.Fields.Append f7
Set f8 = td.CreateField("日期", dbDate, 8)
td.Fields.Append f8
db.TableDefs.Append td
Set db = Nothing
'**************进行数据表的互导******************
Set cnn = New ADODB.Connection
cnn.Provider = "microsoft.jet.oledb.3.51"
cnn.open frmimport.CommonDialog1.filename
cc = CUT_MDB(database_data)
dd = CUT_MDB(frmimport.CommonDialog1.filename)
sql = "insert into " & cc & "" & List1.Text & " select * from " & dd & "" & List1.Text & ""
cnn.Execute sql
MsgBox "成功导入一个数据表!", vbOKOnly + vbInformation, "完成"
frmimport.List1.Refresh
Unload Me
Exit Sub
err:
MsgBox err.Description, vbOKOnly + vbCritical, "出错了"
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -