Hi Forum experts,
I have a situation where someone may have a solution to the problem that I have encountered whilst building this Access 2016 application for work.
Form Design à Form Name: FrmDocNoGen
[IMG]file:///C:/Users/rbelmar/AppData/Local/Temp/msohtmlclip1/01/clip_image002.gif[/IMG]
Form Data Sample:
[IMG]file:///C:/Users/rbelmar/AppData/Local/Temp/msohtmlclip1/01/clip_image004.gif[/IMG]
The situation is that I have “QryDocNoGen” that has some smart expressions that work out the next sequential numbers based on the DeptDisc and DocTypes fields.
Below are the expressions of each field for clarity.
[IMG]file:///C:/Users/rbelmar/AppData/Local/Temp/msohtmlclip1/01/clip_image005.gif[/IMG][IMG]file:///C:/Users/rbelmar/AppData/Local/Temp/msohtmlclip1/01/clip_image006.gif[/IMG][IMG]file:///C:/Users/rbelmar/AppData/Local/Temp/msohtmlclip1/01/clip_image007.gif[/IMG][IMG]file:///C:/Users/rbelmar/AppData/Local/Temp/msohtmlclip1/01/clip_image008.gif[/IMG][IMG]file:///C:/Users/rbelmar/AppData/Local/Temp/msohtmlclip1/01/clip_image010.gif[/IMG]
1. CalcSN: DCount("[DeptDisc]","TblDocumentNumberGenerator","[DeptDisc] = '" & [DeptDisc] & "' and [DocTypes] = '" & [DocTypes] & "' AND [M_Id] <= " & [M_Id])
2. SeqNo: Format([CalcSN],"0000")
3. CalNewDN: ([DeptDisc] & "-" & [DocTypes] & "-" & [SeqNo])
4. NGDocNum
What I want to achieve is that, once the data that is automatically concatenated in field “CalNewDN” a Temp value (e.g. a single letter of number) is allocated so that it will satisfy the Primary Key condition that it cannot be a NULL, then the code will copy the last concatenated entry from the “CalNewDN” field into the Primary Key field “NGDocNum”.
Would anybody be able to help? As I have searched high and low to find a way to get this done but, it’s been a-non-event so far!!
Kind regards,