1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
dim ASName as String
dim ASh as Worksheet
if target & "" <> "" then
Sheets.Add , ActiveSheet
ASName = "Detail_" & Target
Set rec = db.OpenRecordset("select * from user where name ='" & target & "'", DAO.dbOpenSnapshot)
Set ASh = ActiveSheet
ASh.name = ASName
If Not (rec.EOF) Then
Ash.Range("c3") = rec.Fields(1).Value
Ash.Range("c4") = rec.Fields(2).Value
Ash.Range("c5") = rec.Fields(3).Value
End If
end if
Set ASh = Nothing
End Sub |
Partager