If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Ato generated control number
Hi , Thank you for any and all assistance.
I have a customer entry form(CustEntryForm) the fields that I want to auto populate are CreationDate, ControlNumber. The CreationDate date/time stamps when the customer request is created. The ControlNumber is my request tracking field. The CreationDate field works. What I am having a problem with is getting the ControlNumber field to auto generate. The ControlNumber is being created based on the CreationDate field by grabbing the year portion of the date. The date is structured like yy-001(10-001) I have the following SQL statement below in my create request button after the CreationDate field is populated. After the request data is entered you press a button it timestamps it and it is suppose to assign it a ControlNumber, it not is working. Please help. stDocName = "SELECT CAST(substring(cast(datepart(yy,getdate()) as char(4)),3,2)) + '-' + " & _ "replace(str((SELECT CASE WHEN(select count(*) from Forms![Request_log] where datepart(yy,Me![CreationDate]) = datepart(yy,getdate()) group by datepart(yy,Me![CreationDate])) " & _ "IS NULL THEN 0 ELSE (select count(*) from Forms![Request_log] where datepart(yy,Me![CreationDate]) = datepart(yy,getdate()) group by datepart(yy,Me![CreationDate])) END)+1,4),' ','0') ;" |
Thread Tools | |
Display Modes | |
|
|