DateValue Trouble

W

WillRn

I am trying to create a unique id number for each line in a spreadsheet by
combining an existing account number and an audit date.

I have been using the following code:

FollowUpInitial.EventID.Value = CMTAudit.AcctNumberTxt.Value & _
DateValue(CMTAudit.AuditDateTxt.Value)

Unfortunately I keep getting the account number and the standard date format
combined. For Example from and account number of 123456 and 3/24/05 I get:

"1234563/24/05"

What I would like is:

"12345638435"

I know that I am overlooking something pretty simple but it eludes me.

WillRn
 
C

Charlie

FollowUpInitial.EventID.Value = CMTAudit.AcctNumberTxt.Value & _
Replace(DateValue(CMTAudit.AuditDateTxt.Value),"/","")
 
K

K Dales

Use the Format function to format the date to a number, e.g.:
FollowUpInitial.EventID.Value = CMTAudit.AcctNumberTxt.Value & _
Format(DateValue(CMTAudit.AuditDateTxt.Value),"#####")
 
W

WillRn

Thanks for the help Charlie,

But I wanted the system date value number. i.e. - 3/24/05 = 38435

I finally stumbled on the answer using the "Format" function as follows:

FollowUpInitial.EventID.Value = CMTAudit.AcctNumberTxt.Value & _
Format(CMTAudit.AuditDateTxt.Value, vbGeneralDate)

Sometimes I actually find something useful in the VB Help files . . . : )

WillRN
 
W

WillRn

Thanks for the info,

For once I actually discovered the answer myself.

Now, if I could only answer my own VB questions the 3,537 times I have
problems life would be good! . . . : )

Thanks,

WillRn
 
B

Bob Phillips

FollowUpInitial.EventID.Value = CMTAudit.AcctNumberTxt.Value & _
Clng(CMTAudit.AuditDateTxt.Value)

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top