Used by
access 2016
MySq -5.7-x64

External tables are used.

Question.
1. How to make the current date automatically put in the "data_sozd" field when creating a record?
2. How to make the current date automatically appear in the "data_status" field when changing the status?

File link

enter image description here

    1 answer 1

    In Access, for this purpose, so-called. data macros: in the table constructor, on the Design tab, select Create data macros> After insert (After update) and build the expression Edit record> Set field, specify the field name, value = Date ().

    I’m really not sure that this approach works with external tables. Even so, most likely, does not work. In this case, you need to make changes on the MySQL side: set the data_sozd field to the default value ALTER TABLE table_name CHANGE data_sozd DATE NULL DEFAULT CURRENT_TIMESTAMP ; To update the data_status, you need to create a trigger for updating data:

     CREATE TRIGGER trigger_name BEFORE UPDATE ON table_name FOR EACH ROW BEGIN SET new.request_plan_date = CURRENT_TIMESTAMP; END; 

    Here, in order to avoid overwriting the data_sozd value, you can add the line SET NEW.data_sozd = OLD.data_sozd;