Carlos-

Let's call the new field OrderSeq and make it a long integer.  Set the
Format property of the field to 0000000000.  In the BeforeUpdate event of
the form, do this:

Dim varSeqNo As Variant, lngSeqSearch As Long

  ' Set up the start search number
  lngSeqSearch = CLng(Format(Date, "mmddyyyy")) * 100
  ' Look for the previous high number
  varSeqNo = DMax("OrderSeq", "Cust Order", _
    "OrderSeq > " & lngSeqSearch)
  ' If go none,
  If IsNull(varSeqNo) Then
    ' Use the search number
    varSeqNo = lngSeqSearch
  End If
  ' Add 1 and save it
  Me.OrderSeq = varSeqNo + 1


John Viescas, author
"Building Microsoft Access Applications"
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/

> -----Original Message-----
> From: [email protected] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Carlos
> Sent: Friday, July 29, 2005 11:33 PM
> To: [email protected]
> Subject: [ms_access] Date with an auto count
> 
> 
> I want to have a field in my table/form (cust order) where it will
> automatically enter the date and a count for each order process on
> that date.  Then on the next date it starts with a count of (1) again.
> 
> Something like this:
> 
> Orders processed on 6/28/05
> 1st order of the day:        0628200501
> 2nd order of the day:        0628200502
>  and so on
> 
> On the next day it starts with a count of one again.
> 
> Order processed on 6/29/05
> 1st order of the day:        0629200501
> 2nd order of the day:        0629200502
> 3rd order of the day:        0629200203
> 10th order of the day:       0629200510
> 
> 
> Any suggestion on how to do it would be very appreciated.
> 
> 
> Carlos
>  and so on
> 
> 
> 
> 
> 
> 
> 
> ------------------------ Yahoo! Groups Sponsor 
> --------------------~--> 
> <font face=arial size=-1><a 
> href="http://us.ard.yahoo.com/SIG=12hb6eu30/M=362329.6886308.7
> 839368.1510227/D=groups/S=1705115370:TM/Y=YAHOO/EXP=1122705181
> /A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?p
> age_id=1992
> ">Fair play? Video games influencing politics. Click and talk 
> back!</a>.</font>
> --------------------------------------------------------------
> ------~-> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12hvdu9cl/M=362335.6886445.7839731.1510227/D=groups/S=1705115370:TM/Y=YAHOO/EXP=1122735824/A=2894361/R=0/SIG=13jmebhbo/*http://www.networkforgood.org/topics/education/digitaldivide/?source=YAHOO&cmpgn=GRP&RTP=http://groups.yahoo.com/";>In
 low income neighborhoods, 84% do not own computers. At Network for Good, help 
bridge the Digital Divide!</a>.</font>
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ms_access/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to