0

I would like to create a Custom ID in format, "SACYear-Sequential Number", in an Access 2013 Table (Table Name = poledata) when records are appended into that Table.

eg. SAC18-1 (18 means 2018)

I have researched and found the code as below. As advised, I have to add 2 new fields in the Table, alternate_id_seq and alternate_id. However, errors show up for the following lines.

Expression = "SAC" & Year(Date()) Mod 100 & "-"

Look Up A Record In

Select pd.[alternate_id_seq] 
FROM poledata AS pd 
ORDER BY pd.[alternate_id_seq] DESC;

What's going wrong with them?

image description

Community
  • 1
  • 1
Ra-chel
  • 9
  • 1
  • 1
    What is the error message? – BData Jul 27 '18 at 05:42
  • Spent 30 minutes trying to get various DataMacros to set the value in a field with no success. So easy in VBA behind a form. Are you editing directly in table? – June7 Jul 27 '18 at 22:26
  • I finally got the SetField action to work when I included the table name in the field reference. In your case that would be like `poledata.alternate_id_seq`. But if you aren't even getting that far in code execution, that won't fix issue. As already requested, provide error messages. – June7 Jul 27 '18 at 22:46

0 Answers0