End If
MsgBox "此文件编号归档保存完成!", vbOKOnly, "提示"
Else
MsgBox "此文件编号已经存在,请核对后处理!", vbOKOnly + vbCritical, "提示"
End If
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 And Not (TypeOf Me.ActiveControl Is Command) Then
SendKeys "{TAB}"
End If
If KeyCode = vbKeyEscape Then
Unload Me
End If
End Sub
Private Sub Form_Load()
Set cn0 = New ADODB.Connection
'连接信息赋予字符串
strcn0 = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False" & _
";Data Source=" & App.Path & "\datebase.mdb"
Catalog=" & App.Path & "\DateBase"
cn0.Open strcn0
Set rs0 = New ADODB.Recordset
Set rs0.ActiveConnection = cn0
rs0.CursorType = adOpenKeyset
rs0.LockType = adLockBatchOptimistic
Text11.Text = name1
DTPicker1.Value = Now
DTPicker2.Value = Now
DTPicker0.Value = Now
End Sub
2.从数据库里读取文件并浏览的过程实例
Dim cn0 As ADODB.Connection '定义连接
Dim rs0, Rs1 As ADODB.Recordset '定义记录集
Dim strcn0, str1 As String
Dim a0 As String '记录打开的文件
Private Declare Function ShellExecuteA Lib "shell32.dll" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Sub Command1_Click()
If Trim(Text1) <> "" Then str1 = "SELECT * FROM 资料信息 where 资料名 like '%" & Trim(Text1) & "%' "
If Trim(Text2) <> "" Then
|