In an MS Access 2007 application, I need to generate a document name of [Date].[SequenceNumber], eg 2010-12-07.013, where each day the SequenceNumber resets to 1.
To maintain data integrity, I'd like to create a function in MySQL that returns the sequence number. I set up a 'sequence' table:
CREATE TABLE `doc_sequence_number` (
`SequenceDate` date NOT NULL,
`SequenceNumber` int(11) NOT NULL,
`ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`SequenceDate`,`SequenceNumber`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
The MySQL function should create a new record, using the server's Date, and the Sequence Number incremented by 1, and return the SequenceDate and SequenceNumber fields.
Can anyone suggest how such a Function should be written (this is my first MySQL function).
How can I call and get the return value(s) via ODBC of such a function, using VBA?
As this is new to me, I'd appreciate any suggestions on how to accomplish this. MTIA.