[AccessD] Call txt_AfterUpdate From a Standard Module

Dan Waters dwaters at usinternet.com
Sun Oct 16 09:57:40 CDT 2005


I'm going to add a calendar button adjacent to each date field throughout
many forms.  The code, a public function procedure, will be in a standard
module (in a library).  Each calendar button will call the function
procedure using a call from the OnClick event procedure of the button.  The
call in the event procedure is this:

 

     =CalendarButton("frmName","txtName",True)

 

 

The function is this:

 

Public Function CalendarButton(stgForm As String, stgDate As String,
blnAfterUpdate as Boolean)

 

    Dim frm As Form

    Dim txtDate As TextBox

    

    Set frm = Forms(stgForm)

    Set txtDate = frm.Controls(stgDate)

    

    If txtDate.Enabled = False or txtDate.Locked = True Then

        Set frm = Nothing

        Set txtDate = Nothing

        Exit Function

    End If

    

    txtDate = PopupCalendar(txtDate)

 

    '--- Call back to the control's AfterUpdate event for validation

    If blnAfterUpdate = True Then

        Call frm.txtDate_AfterUpdate   <------------ This line doesn't work.

        Call frm.txtCustomerDueDate_AfterUpdate  <-- Works, but doesn't
help.

    End If

 

    If Not IsNull(txtDate) Then

        SendKeys Chr(9)  '-- Tab Key

    End If

 

End Function

 

 

I need to call the field's AfterUpdate procedure (which is now Public) to
perform validation, which is different for different date fields.  Is there
a way to do this?

 

Thanks!

Dan

 

 

 

 




More information about the AccessD mailing list