Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form counter 2

Status
Not open for further replies.

vaylen

Technical User
Nov 11, 2002
25
GB
I have been looking for an easy way to give a new form a number each time a user enters one.

Like in a help desk where call 1000 would be the first call and the next form would have a call number 1001 (auto)

I guess this is not easy as some of the code to do it I have look at is a tad on the hard side.

So how can I have a field on a form that is added to each time a new form is opened.

Hope that is clear !
 
see thread245-184386 for more information on autonumbering


Leslie
landrews@metrocourt.state.nm.us

There are 10 types of people in the world -
those who understand binary
and
those who don't!
 
One way I've done this in previous projects is to generate a number based on the date and time the form was created. This would create a new number every minute. The only drawback would be if two documents where created in the one minute.

The following code generates a number like 14073-1706 if the form was created on July 14 03 at 1706. Just use it as the default value of a Computed When Composed field.

YearString := @Right(@Text(@Year(@Now)); 1);
MonthString := @If(@Month(@Now) >= 10; @Text(@Month(@Now)); "0" + @Text(@Month(@Now)));
DayString := @If(@Day(@Now) >= 10; @Text(@Day(@Now)); "0" + @Text(@Day(@Now)));
HourString := @If(@Hour(@Now) >= 10; @Text(@Hour(@Now)); "0" + @Text(@Hour(@Now)));
MinuteString := @If(@Minute(@Now) >= 10; @Text(@Minute(@Now)); "0" + @Text(@Minute(@Now)));
@If(@IsNewDoc;DayString + MonthString + YearString + "-" + HourString + MinuteString;fieldname)

Hope this helps
 
Thanks guys. Helped me some but still not got it to work !!

Thanks for your time
 
Thanks for the help folks got it working now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top