afterUpdate() event does not fire

G

Guest

Why does my AfterUpdate() event not fire after I add a new record? I add the
record in the form and click the next record button at the bottom and nothing
happens? I want to test this code?
tia,
-------------code-------------


Option Compare Database

Private Declare Function CreateFile& Lib "kernel32" Alias "CreateFileA" _
(ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal
dwShareMode As Long, _
lpSecurityAttributes As Any, ByVal dwCreationDisposition As Long, _
ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long)
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long)
As Long














Private Sub Form_AfterUpdate()
'--------------------------------------------------------------------------- _
Purpose: _
----------------------------------------------------------------------------


Dim lngFileHandle As Long
Dim lngLastError As Long
Const STR_DIRECTORY_PATH = "c:\Test"
Const STR_FileName = "emp.xls"
Const OPEN_EXISTING = 3&


Select Case Check_Dir_File
Case 1
'Check if directory exists

If Dir(STR_DIRECTORY_PATH) = "" Then
MkDir STR_DIRECTORY_PATH
End If
Case 2
'Check file exists
If Dir(STR_DIRECTORY_PATH & STR_FileName = "") Then
lngFileHandle = CreateFile(strFileName, 0, 0, ByVal 0&, OPEN_EXISTING, _
0, ByVal 0&)

End If

End Select

End Sub
 
G

Guest

Have you set a breakpoint to see if you can actually see if it is hitting the
event or not?

If you have set a breakpoint and it isn't firing after you add, or edit,
information in the form then you might be suffering from corruption and you
might try importing all of your objects into a new, blank MDB file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top