PC Review


Reply
Thread Tools Rate Thread

date and number

 
 
=?Utf-8?B?a2F3dGhlcg==?=
Guest
Posts: n/a
 
      22nd Jan 2007

i am developing a database one of the felid i need it to be YY-MM-XXX
year then the month and sqe.No such as 2007-01-0001, how can i create it

the field must be auto generate once the form open to enter the data

thanx in advance for
 
Reply With Quote
 
 
 
 
strive4peace
Guest
Posts: n/a
 
      22nd Jan 2007
Hi kawther,

you can use the form BeforeInsert event if the data is already known --
or the control AfterUpdate event if the data is only known after a
control is filled out

'~~~~~~~~~~~~~~~~`
dim mMask as string _
, mNextNumber as long

mMask = format(someDate, "yyyy-mm")

mNextNumber = nz( _
dMax( _
"mid([fieldname], 9, len([fieldname])-8)" +
,"[tablename]" _
, "left([fieldname], 7) = '" & mMask & "'" _
),0)

me.controlname = mMask & format(mNextNumber, "0000")

'~~~~~~~~~~~~~~~~

where

-- someDate is a fieldname or a controlname or a variable -->

ie:
me.date_controlname
mDateVariable

-- [fieldname] is the name of the fieldname to lookup
(store as text, length = 12)

-- [tablename] is the name of the table with the data

~~~~

even though you said the mask was YY-MM-XXX, I used your data example
with mask --> yyyy-mm-9999


Warm Regards,
Crystal
*
(: have an awesome day
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*



kawther wrote:
> i am developing a database one of the felid i need it to be YY-MM-XXX
> year then the month and sqe.No such as 2007-01-0001, how can i create it
>
> the field must be auto generate once the form open to enter the data
>
> thanx in advance for

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Removing Revision Number and Edit Time, Date Created, Date Last Sa Collected Letters Microsoft Word Document Management 8 25th Sep 2011 03:25 AM
Creating a date from week number, day number and year value Clddleopard Microsoft Access 1 12th Oct 2009 10:09 PM
Re: Excel Formula to calulate number of days passed from date to date Roger Govier Microsoft Excel Misc 0 4th Jan 2007 09:14 PM
Re: Year(Number) And Date(Number) input to date range output Wayne Morgan Microsoft Access 0 30th Sep 2003 12:04 AM
Year(Number) And Date(Number) input to date range output Connie Microsoft Access 0 29th Sep 2003 05:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:09 AM.