Nguyễn Văn Phẩm > 11-07-13, 06:32 PM
paulsteigel > 11-07-13, 06:58 PM
Function GetCodeEvent(strModuleName As String, strProcName As String) As String
Dim mdl As Module
Dim lngStartLine As Long, lngBodyLine As Long
Dim lngCount As Long, lngEndProc As Long
' Open specified Module object.
DoCmd.OpenModule strModuleName
' Return reference to Module object.
Set mdl = Modules(strModuleName)
' Count lines in procedure.
On Error GoTo Err_Trap
lngCount = mdl.ProcCountLines(strProcName, vbext_pk_Proc)
' Determine start line.
lngStartLine = mdl.ProcStartLine(strProcName, vbext_pk_Proc)
' Determine body line.
lngBodyLine = mdl.ProcBodyLine(strProcName, vbext_pk_Proc)
Debug.Print
' Determine line number of last line in procedure.
lngEndProc = (lngBodyLine + lngCount - 1) - Abs(lngBodyLine - lngStartLine)
' Print all lines in body of procedure.
GetCodeEvent = mdl.Lines(lngBodyLine, (lngEndProc - lngBodyLine) + 1)
Debug.Print GetCodeEvent
Exit Function
Err_Trap:
Select Case Err.Number
Case 35:
GetCodeEvent = ""
Case Else
MsgBox Err.Number & Err.Description
End Select
End Function
Function ObjectCreateEvent(frmName As String, iProcName As String, iProcDetails As String) As Boolean
Dim frm As Form, ctl As Control, mdl As Module
Dim lngReturn As Long
On Error GoTo Error_ClickEventProc
DoCmd.OpenForm frmName, acDesign
' Return reference to form module.
Set mdl = Forms(frmName).Module
' Add event procedure.
lngReturn = mdl.CreateEventProc(iProcName, frmName)
' Insert text into body of procedure.
mdl.InsertLines lngReturn + 1, iProcDetails
ObjectCreateEvent = True
' Return reference to form module.
DoCmd.Save acForm, frmName
Exit Function
Exit_ClickEventProc:
Exit Function
Error_ClickEventProc:
MsgBox Err & " :" & Err.Description
ObjectCreateEvent = False
Resume Exit_ClickEventProc
End Function
Minh Tiên > 12-07-13, 11:18 AM
Nguyễn Văn Phẩm > 13-07-13, 08:00 AM
paulsteigel > 13-07-13, 11:42 AM
(13-07-13, 08:00 AM)Nguyễn Văn Phẩm Đã viết: Mình chỉ đơn giản là viết một chương trình lưu trữ các hàm trong access trong đó có một đoạn code ví dụ cho hàm đó thôi
Nguyễn Văn Phẩm > 14-07-13, 03:03 PM
paulsteigel > 14-07-13, 03:48 PM
(14-07-13, 03:03 PM)Nguyễn Văn Phẩm Đã viết: Như thế mình thấy nó thẳng một hàng liệu khi đưa vào trong textbox nó có xuống dòng được không?