A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Ato generated control number



 
 
Thread Tools Display Modes
  #1  
Old December 10th, 2009, 07:42 PM posted to microsoft.public.access.forms
MyMel
external usenet poster
 
Posts: 7
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:30 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.