database - How do I make a button in an MS Access form create a date stamp, THEN not allow further edits? -
the code date stamp simple enough.
private sub cmdmybutton_click() txtthingdatestamped.locked = false txtthingdatestamped = now() txtthingdatestamped.locked = true end sub but users can still hit date stamp multiple times , can edited other forms.
i used ms access project management template start adventure here. 2 forms i'm working (1) "project details" , (2) "project list".
you use before change data macro on table enforce constraint @ level:

<?xml version="1.0" encoding="utf-16" standalone="no"?> <datamacros xmlns="http://schemas.microsoft.com/office/accessservices/2009/11/application"> <datamacro event="beforechange"> <statements> <conditionalblock> <if> <condition>updated("thingdatestamped")</condition> <statements> <conditionalblock> <if> <condition>not isnull([old].[thingdatestamped])</condition> <statements> <action name="raiseerror"> <argument name="number">1</argument> <argument name="description">an existing datestamp cannot altered.</argument> </action> </statements> </if> </conditionalblock> </statements> </if> </conditionalblock> </statements> </datamacro> </datamacros>
Comments
Post a Comment