DatePart() invalid argument???

Agism

Registered User.
Local time
Today, 17:18
Joined
Jun 25, 2001
Messages
43
I am trying to create a "TripID" with the area of the trip and leave date. For example, say you are visiting the West on 7/5/02, I would like the TripID to become West070502.

I have tried DatePart("dd",me.BeginDate) and I get this error:

Run-time Error '5'
Invalid procedure call or argument.

I have also tried Format(me.BeginDate,"dd") & Format(me.BeginDate, "dd") & Format(me.BeginDate,"yy") and received 777.

Anyone know what my problem is?

Thanks in advance!:confused:
 
Try this.

Dim TripID As String

TripID = "West"
TripID = TripID & Format(DatePart("d",#7/5/02#),"00")
TripID = TripID & Format(DatePart("m",#7/5/02#),"00")
TripID = TripID & Right(DatePart("yyyy",Me.BeginDate),2)

I wonder what's wrong with Format with you.

I tried it out and resulted like this.

? Format(#7/5/02#,"yy")
02
? Format(#7/5/02#,"dd")
05
? Format(#7/5/02#,"mm")
07

Where are you anyhow? What country?
 
Pat -

Thank you for your help. I was certain that you would have something for me. I agree with your views on "intelligent" keys. This is just what those in charge wanted to see.

Tim K. - I am in Texas, USA. Thanks for your help!
 

Users who are viewing this thread

Back
Top Bottom