-----Original Message-----
Here is code, but I get error msg that "ambiguous name
detected: Form_AfterUpdate"
Option Compare Database
Private Sub Form_AfterUpdate()
With Me![ADS]
.DefaultValue = """" & .Value & """"
End With
End Sub
I also put ADS between """", but that did not work
either. Does the lookup field cause this? [Event
Procedure] is in Before Update field of Event. Date
still works.
That message means that you have two procedures with the same name:
"Form_AfterUpdate". And it happens because you already had an event
procedure for the form's AfterUpdate event (presumably the one you added
to deal with the [Date] control), and pasted the whole routine above
into your form's code module. Because you already had a
Form_AfterUpdate event procedure, you should have just added the lines
*between* the "Private Sub" and "End Sub" lines -- and not including
those lines -- to the existing procedure.
To fix it:
Remove the second AfterUpdate event procedure, so there's only the old
one in the form's module. Then go to that old procedure and insert the
following lines before the End Sub line:
With Me![ADS]
.DefaultValue = """" & .Value & """"
End With
So now the procedure looks something like this:
'----- start of procedure -----
Private Sub Form_AfterUpdate()
With Me![Date]
.DefaultValue = Format(.Value, "\#mm/dd/yyyy\#")
End With
With Me![ADS]
.DefaultValue = """" & .Value & """"
End With
End Sub
'----- end of procedure -----
That ought to do the job. Make sure, after you're done modifying the
event procedure, that the form's AfterUpdate event property still reads
"[Event Procedure]".
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
.