Calculated Field

R

rech340

Hi,

I have a query with a calculated field called Export.

Export looks like this: Export: "IWTP" & "-" & [CourseID] & "-" &
[VendorID]

The CourseID is a 4-digit autonumber field with a format of 0000, and
VendorID is 3-digit autonumber field with a format of 000. They work
fine when you're looking at individual field in the query. It's when I
put them together in Export calculated field, it drops the leading
zeros from CourseID and VendorID. I have tried everything to get this
to work.

Any help is greatly appreciated.
 
J

John Vinson

Hi,

I have a query with a calculated field called Export.

Export looks like this: Export: "IWTP" & "-" & [CourseID] & "-" &
[VendorID]

The CourseID is a 4-digit autonumber field with a format of 0000, and
VendorID is 3-digit autonumber field with a format of 000. They work
fine when you're looking at individual field in the query. It's when I
put them together in Export calculated field, it drops the leading
zeros from CourseID and VendorID. I have tried everything to get this
to work.

Any help is greatly appreciated.

Try using the Format() function to explicitly set the displayed size:

Export: "IWTP-" & Format([CourseID], "0000") & Format([VendorID],
"\-000")

I'm saving a couple of quoted strings by including the first hyphen in
the text string, and the second as a literal value in the Format.

John W. Vinson[MVP]
 

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