我倒.你不知道..谁知道啊...
这个程序是别人作过的我拿来用不好用了,你能帮我看看么
Option Explicit
Private Type SHFILEOPSTRUCT
hwnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAnyOperationsAborted As Long
hNameMappings As Long
lpszprogressTitle As String
End Type
Private Declare Function SHFileOperation Lib _
"shell32" _
(lpFileOp As SHFILEOPSTRUCT) As Long
Private Declare Function GetWindowsDirectory _
Lib "kernel32" Alias "GetWindowsDirectoryA" _
(ByVal lpBuffer As String, ByVal nSize As _
Long) As Long
Const FO_COPY = &H2
Const FO_DELETE = &H3
Const FO_MOVE = &H1
Const FO_RENAME = &H4
Const FOF_ALLOWUNDO = &H40
Const FOF_NOCONFIRMATION = &H10
Const FOF_NOCONFIRMMKDIR = &H200
Dim MustSave As Boolean
Dim aa As String
Dim cnDB As Connection
Dim Rs As Recordset
Dim Rs1 As Recordset
Dim fpSpread1 As String
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_Load()
MustSave = False
Set cnDB = New Connection
cnDB.Open ConString
fpSpread1.Row = -1
fpSpread1.Col = -1
fpSpread1.DAutoHeadings = False
fpSpread1.CellType = 1
fpSpread1.TypeMaxEditLen = 225
Set Rs = New Recordset
Set Rs1 = New Recordset
Rs.Open "Select * from bm", cnDB, adOpenStatic, adLockOptimistic
Set fpSpread1.DataSource = Rs
'fpSpread1.MaxRows = fpSpread1.DataRowCnt
fpSpread1.DAutoSizeCols = 0
fpSpread1.Col = 1
fpSpread1.Row = SpreadHeader
fpSpread1.Text = "部门"
If Rs.RecordCount > 0 Then
Rs.MoveFirst
aa = Rs.Fields(0)
Else
aa = ""
End If
Rs1.Open "Select * from bm where name='" & aa & "'", cnDB, adOpenStatic, adLockOptimistic
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Unload MyDialog
End Sub
Private Sub fpSpread1_EditChange(ByVal Col As Long, ByVal Row As Long)
MustSave = False
End Sub
Private Sub nowDelete_Click()
If Rs.RecordCount > 0 Then
DeleteForm.Label3.Caption = Rs.Fields(0).Value
DeleteForm.Lable4.Caption = "weihu1"
DeleteForm.Show
End If
End Sub
Public Sub RefreshDate_Click()
cnDB.Close
cnDB.Open ConString
Rs.Open "Select * from bm", cnDB, adOpenStatic, adLockOptimistic
If Rs.RecordCount > 0 Then
aa = Rs.Fields(0)
Else
aa = ""
End If
Rs1.Open "Select * from bm where name='" & aa & "'", cnDB, adOpenStatic, adLockOptimistic
Set fpSpread1.DataSource = Rs
fpSpread1.MaxRows = fpSpread1.DateRowCnt
End Sub