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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a ID number from the date and time entered

Status
Not open for further replies.

speltrain

Technical User
Apr 29, 2003
17
0
0
US
Is there a way I can create an ID number on a form based on the date and time the record was entered. I am trying to migrate away from the field that is being used.

If the whole date time thing isn't doable, then is there a way to write a vb procedure to mimic it? What would the code consist of?

Can anyone help?
 
Look at the format function. Something like the following should work (I can't verify the syntax so it may be off a little bit).

Dim lngID As Long
lngID = Val(Format(Date(), "yyyymmdd") & _
Format(Time(), "mmhhss"))

Good Luck!

 
Try MsgBox Val(Format(Date, "yyyymmdd") & _
Format(Time, "hhmmss"))

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top