Hi,
I',\m already success to display value from mdb database into crystal report.....i got some problem that is ...
how to display item with own format into crystal report..The situation is..in my database the field is like this = EPS0000000 with autonumber function. But when display in crsytal report it just display = 1,to next value shown = 2...

Ho to display all characters?.....lpz

Dani AI

Generated

Following s question and s suggestion: Access Autonumber is stored as a numeric value; any "EPS0000001" mask you see in Access is a display format only. Crystal Reports reads the raw numeric value (1, 2, 3), so you need to build the formatted string yourself either in the report or in the data you send to the report.

A simple Crystal formula that recreates the prefix and leading zeros (adjust the zero count and length to match your format) is:

"EPS" + Right("0000000" + ToText({YourTable.YourAutoNumberField}, 0, ""), 7)

Replace {YourTable.YourAutoNumberField} with your field. ToText(..., 0, "") converts the number to text with no decimals and no thousands separator. Right(..., 7) picks the last 7 digits of the zero-padded string; change 0000000 and 7 to the number of numeric digits you need.

If you prefer to have the value ready before it reaches Crystal, compute the formatted field in Access or in your .NET layer. In an Access query you can add a calculated column like:

FormattedID: "EPS" & Format([AutoID], "0000000")

Then bind the report to that query/field or add a computed column to your DataTable.

Troubleshooting notes: do not change the Autonumber column to text in the database (keeps keys and relationships intact). If the formula still shows raw numbers, verify the report field is the formula (not the original numeric field), check grouping/summarization, and confirm ToText uses the no-thousands parameter so commas do not appear.

Recommended Answers

All 2 Replies

kerek2,
Use string functions in crystal report design.

Tq bro,

Can u give me the example?..because in my database already formating in number...how to change to string function?...hope ur advice here...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.