Event procedure not matching

G

Guest

I have a form that the user can enter dates. Or erase the dates that are
there and insert new ones. I'm getting an error message"The expression After
Update you entered as the event property setting produced the following
error: Event procedure declaration does not match description of event
having the same name.

I cannot figure out where I have the same name. Could someone help.

Thank you.

Here is the code that I have for the date field:

Private Sub IPV1DOS_Text_AfterUpdate(Cancel As Integer)

Dim TextDate As Date
TextDate = DateSerial(Right(Me!IPV1DOS.Value, 4), _
Left(Me!IPV1DOS.Value, 2), _
Mid(Me!IPV1DOS.Value, 3, 2))
Select Case TextDate
Case #10/1/2002# To #9/30/2005#
' do nothing
Cancel = True
Case Else
MsgBox "You have entered an invalid date."
Cancel = True
End Select
End Sub
 
D

Dirk Goldgar

melwester said:
I have a form that the user can enter dates. Or erase the dates that
are there and insert new ones. I'm getting an error message"The
expression After Update you entered as the event property setting
produced the following error: Event procedure declaration does not
match description of event having the same name.

I cannot figure out where I have the same name. Could someone help.

Thank you.

Here is the code that I have for the date field:

Private Sub IPV1DOS_Text_AfterUpdate(Cancel As Integer)

Dim TextDate As Date
TextDate = DateSerial(Right(Me!IPV1DOS.Value, 4), _
Left(Me!IPV1DOS.Value, 2), _
Mid(Me!IPV1DOS.Value, 3, 2))
Select Case TextDate
Case #10/1/2002# To #9/30/2005#
' do nothing
Cancel = True
Case Else
MsgBox "You have entered an invalid date."
Cancel = True
End Select
End Sub

It's not that you have another procedure with the same name, it's that
the AfterUpdate event procedure doesn't have a Cancel argument. It
looks like your code belongs in a BeforeUpdate event procedure.

Note, in passing, that this:
Case #10/1/2002# To #9/30/2005#
' do nothing
Cancel = True

should probably be setting Cancel to False, not True.
 

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