String Used in Report Displays as Garbage

  • Thread starter Thread starter Ken
  • Start date Start date
K

Ken

I have an Access 2000 database application that I am developing. The
problem is that in one of my queries I am calculating a string as a
combination of other strings. The calculation works fine and the values are
as expected when I open the query. However, when I view the same query data
in a report the calculated values appear as garbage. The values look like
registry key values inside the {} brackets. Any idea as to what might cause
this? Thanks.
 
This could be a display issue, a data type issue, or a corruption issue.

Display
=====
What font is used in the report? Test with the basic fonts like Arial or
Times New Roman.

Check the properties of the text box, e.g. ReadingOrder and NumericalShapes.

Make sure there is nothing in the Format property of the text box that would
force it to interpret the data differently than expected.

Any chance of confusion about whether this is 8-bit ASCII data or Unicode
data?

Data type
=======
You say the calculation looks fine in the query.
Does it left-align (like text), or right-align (like numbers)?

Make sure there is nothing in the Format property of the text box in the
query.

Try explicitly typecasting the result of the calcuation. For example, if you
have:
[Qty] * [PriceEach]
try:
CDbl(Nz([Qty] * [PriceEach], 0))
More info on this in:
Calculated fields misinterpreted
at:
http://allenbrowne.com/ser-45.html

Corruption
=======
If neither of the above proves fruitful, it is possible that:
a) the report is corrupt,
b) the data is corrupt,
c) Access is confused about what refers to what,
d) the code is corrupt.

Start by ensuring the Name AutoCorrect boxes are unchecked under:
Tools | Options | General
Then compact/repair the database. That could take care of (b) and (c).

(d) would apply only if the query or report calls a VBA function. If so, try
a decompile, followed by a compact.

To demonstrate (a), create another report based on this query, with just the
one field if you like. If this one works, you can develop it further and
discard the bad one. (If the report is complex, you might be able to rescue
it with the undocumented SaveAsText/LoadFromText.)
 
Thanks for the post reply. I tried everything I could from your post. Some
additional information in response to your questions,

1) I am only using ARIAL and TIMES NEW ROMAN fonts throughout all my reports.
2) I do not understand what you are referring to when you say READINGORDER
and NUMERICALSHAPES property settings. These do not exist as properties for
text boxes, at least not that I can see.
3) There sure might be confusion over 8-bit ASCII and unicode, I sure am.
But I do not know how to check or fix this.
4) All the text in the calculated fields in my query are left aligned. In
fact, all look to be text, as they should be.
5) What is the explicit function to ensure the calculated fileds return a
test string? Is it CSTR?

I tried creating a new report with only the calculated field printed. I get
the same result, it prints to the report as a series of numbers and letters
inside the { and } brackets.

When I simply open the query directly I see the field values exactly as I
expect them. I am simply combining three text strings into another text
string. The strings look like this "9573", "SP" and "REG" being combined
into "9573SPREG".



Allen Browne said:
This could be a display issue, a data type issue, or a corruption issue.

Display
=====
What font is used in the report? Test with the basic fonts like Arial or
Times New Roman.

Check the properties of the text box, e.g. ReadingOrder and NumericalShapes.

Make sure there is nothing in the Format property of the text box that would
force it to interpret the data differently than expected.

Any chance of confusion about whether this is 8-bit ASCII data or Unicode
data?

Data type
=======
You say the calculation looks fine in the query.
Does it left-align (like text), or right-align (like numbers)?

Make sure there is nothing in the Format property of the text box in the
query.

Try explicitly typecasting the result of the calcuation. For example, if you
have:
[Qty] * [PriceEach]
try:
CDbl(Nz([Qty] * [PriceEach], 0))
More info on this in:
Calculated fields misinterpreted
at:
http://allenbrowne.com/ser-45.html

Corruption
=======
If neither of the above proves fruitful, it is possible that:
a) the report is corrupt,
b) the data is corrupt,
c) Access is confused about what refers to what,
d) the code is corrupt.

Start by ensuring the Name AutoCorrect boxes are unchecked under:
Tools | Options | General
Then compact/repair the database. That could take care of (b) and (c).

(d) would apply only if the query or report calls a VBA function. If so, try
a decompile, followed by a compact.

To demonstrate (a), create another report based on this query, with just the
one field if you like. If this one works, you can develop it further and
discard the bad one. (If the report is complex, you might be able to rescue
it with the undocumented SaveAsText/LoadFromText.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Ken said:
I have an Access 2000 database application that I am developing. The
problem is that in one of my queries I am calculating a string as a
combination of other strings. The calculation works fine and the values
are as expected when I open the query. However, when I view the same query
data in a report the calculated values appear as garbage. The values look
like registry key values inside the {} brackets. Any idea as to what might
cause this? Thanks.
 
Okay, you have a calculated field in your query.
Could you post this field please?
Presumably it says something like:
MyField: [Field1] & [Something] & [Another]

In report design view, what exactly do you have in these properties of the
problem text box:
Control Source (Data tab)
Format (Format tab)
Name (Other tab)

ReadingOrder and NumericalShapes exist only in Access 2002 and later. If you
are using these versions you should have:
ReadingOrder: Context.
NumericalShapes: System

Unicode is present in Access 2000 and later.
Do you have multiple languages installed?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Ken said:
Thanks for the post reply. I tried everything I could from your post.
Some
additional information in response to your questions,

1) I am only using ARIAL and TIMES NEW ROMAN fonts throughout all my
reports.
2) I do not understand what you are referring to when you say READINGORDER
and NUMERICALSHAPES property settings. These do not exist as properties
for
text boxes, at least not that I can see.
3) There sure might be confusion over 8-bit ASCII and unicode, I sure am.
But I do not know how to check or fix this.
4) All the text in the calculated fields in my query are left aligned. In
fact, all look to be text, as they should be.
5) What is the explicit function to ensure the calculated fileds return a
test string? Is it CSTR?

I tried creating a new report with only the calculated field printed. I
get
the same result, it prints to the report as a series of numbers and
letters
inside the { and } brackets.

When I simply open the query directly I see the field values exactly as I
expect them. I am simply combining three text strings into another text
string. The strings look like this "9573", "SP" and "REG" being combined
into "9573SPREG".



Allen Browne said:
This could be a display issue, a data type issue, or a corruption issue.

Display
=====
What font is used in the report? Test with the basic fonts like Arial or
Times New Roman.

Check the properties of the text box, e.g. ReadingOrder and
NumericalShapes.

Make sure there is nothing in the Format property of the text box that
would
force it to interpret the data differently than expected.

Any chance of confusion about whether this is 8-bit ASCII data or Unicode
data?

Data type
=======
You say the calculation looks fine in the query.
Does it left-align (like text), or right-align (like numbers)?

Make sure there is nothing in the Format property of the text box in the
query.

Try explicitly typecasting the result of the calcuation. For example, if
you
have:
[Qty] * [PriceEach]
try:
CDbl(Nz([Qty] * [PriceEach], 0))
More info on this in:
Calculated fields misinterpreted
at:
http://allenbrowne.com/ser-45.html

Corruption
=======
If neither of the above proves fruitful, it is possible that:
a) the report is corrupt,
b) the data is corrupt,
c) Access is confused about what refers to what,
d) the code is corrupt.

Start by ensuring the Name AutoCorrect boxes are unchecked under:
Tools | Options | General
Then compact/repair the database. That could take care of (b) and (c).

(d) would apply only if the query or report calls a VBA function. If so,
try
a decompile, followed by a compact.

To demonstrate (a), create another report based on this query, with just
the
one field if you like. If this one works, you can develop it further and
discard the bad one. (If the report is complex, you might be able to
rescue
it with the undocumented SaveAsText/LoadFromText.)

Ken said:
I have an Access 2000 database application that I am developing. The
problem is that in one of my queries I am calculating a string as a
combination of other strings. The calculation works fine and the values
are as expected when I open the query. However, when I view the same
query
data in a report the calculated values appear as garbage. The values
look
like registry key values inside the {} brackets. Any idea as to what
might
cause this? Thanks.
 
The problem textbox has the following settings,

Control Source = ProductCode (the name of the calculated field in my
Query)
Format = (no setting)
Name = txtProductCode

And, the ProductCode filed in the Query has the following,

ProductCode: [Products]![ProductBaseCode] & [Products]![CustCode] &
[Products]![SizeCode]

where [Products] is a TABLE with the basic text data.

Regarding multiple languages, no I do not have this installed. Only using
English.

One other piece of info which may be important is that I have developed this
database on two PCs, one which has Access2000 and the other which has
Access2002 (ie. OfficeXP). On the 2002 machine I am saving the database as
2000 format.

Allen Browne said:
Okay, you have a calculated field in your query.
Could you post this field please?
Presumably it says something like:
MyField: [Field1] & [Something] & [Another]

In report design view, what exactly do you have in these properties of the
problem text box:
Control Source (Data tab)
Format (Format tab)
Name (Other tab)

ReadingOrder and NumericalShapes exist only in Access 2002 and later. If you
are using these versions you should have:
ReadingOrder: Context.
NumericalShapes: System

Unicode is present in Access 2000 and later.
Do you have multiple languages installed?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Ken said:
Thanks for the post reply. I tried everything I could from your post.
Some
additional information in response to your questions,

1) I am only using ARIAL and TIMES NEW ROMAN fonts throughout all my
reports.
2) I do not understand what you are referring to when you say READINGORDER
and NUMERICALSHAPES property settings. These do not exist as properties
for
text boxes, at least not that I can see.
3) There sure might be confusion over 8-bit ASCII and unicode, I sure am.
But I do not know how to check or fix this.
4) All the text in the calculated fields in my query are left aligned. In
fact, all look to be text, as they should be.
5) What is the explicit function to ensure the calculated fileds return a
test string? Is it CSTR?

I tried creating a new report with only the calculated field printed. I
get
the same result, it prints to the report as a series of numbers and
letters
inside the { and } brackets.

When I simply open the query directly I see the field values exactly as I
expect them. I am simply combining three text strings into another text
string. The strings look like this "9573", "SP" and "REG" being combined
into "9573SPREG".



Allen Browne said:
This could be a display issue, a data type issue, or a corruption issue.

Display
=====
What font is used in the report? Test with the basic fonts like Arial or
Times New Roman.

Check the properties of the text box, e.g. ReadingOrder and
NumericalShapes.

Make sure there is nothing in the Format property of the text box that
would
force it to interpret the data differently than expected.

Any chance of confusion about whether this is 8-bit ASCII data or Unicode
data?

Data type
=======
You say the calculation looks fine in the query.
Does it left-align (like text), or right-align (like numbers)?

Make sure there is nothing in the Format property of the text box in the
query.

Try explicitly typecasting the result of the calcuation. For example, if
you
have:
[Qty] * [PriceEach]
try:
CDbl(Nz([Qty] * [PriceEach], 0))
More info on this in:
Calculated fields misinterpreted
at:
http://allenbrowne.com/ser-45.html

Corruption
=======
If neither of the above proves fruitful, it is possible that:
a) the report is corrupt,
b) the data is corrupt,
c) Access is confused about what refers to what,
d) the code is corrupt.

Start by ensuring the Name AutoCorrect boxes are unchecked under:
Tools | Options | General
Then compact/repair the database. That could take care of (b) and (c).

(d) would apply only if the query or report calls a VBA function. If so,
try
a decompile, followed by a compact.

To demonstrate (a), create another report based on this query, with just
the
one field if you like. If this one works, you can develop it further and
discard the bad one. (If the report is complex, you might be able to
rescue
it with the undocumented SaveAsText/LoadFromText.)

I have an Access 2000 database application that I am developing. The
problem is that in one of my queries I am calculating a string as a
combination of other strings. The calculation works fine and the values
are as expected when I open the query. However, when I view the same
query
data in a report the calculated values appear as garbage. The values
look
like registry key values inside the {} brackets. Any idea as to what
might
cause this? Thanks.
 
Thanks, Ken. It's hard to see how Access could get this one wrong.

Is there anything else in the database that has the name ProductCode?

I presume you have already unchecked the Name AutoCorrect boxes under:
Tools | Options | General

Try changing the Name of the text box to the same as the field (i.e. drop
the txt prefix.) Then compact the database.

If that doesn't work, I would like to see this wonder. If it is small enough
to zip, email it to the address in the sig below, and I will try to look at
it tomorrow.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Ken said:
The problem textbox has the following settings,

Control Source = ProductCode (the name of the calculated field in
my
Query)
Format = (no setting)
Name = txtProductCode

And, the ProductCode filed in the Query has the following,

ProductCode: [Products]![ProductBaseCode] & [Products]![CustCode] &
[Products]![SizeCode]

where [Products] is a TABLE with the basic text data.

Regarding multiple languages, no I do not have this installed. Only using
English.

One other piece of info which may be important is that I have developed
this
database on two PCs, one which has Access2000 and the other which has
Access2002 (ie. OfficeXP). On the 2002 machine I am saving the database
as
2000 format.

Allen Browne said:
Okay, you have a calculated field in your query.
Could you post this field please?
Presumably it says something like:
MyField: [Field1] & [Something] & [Another]

In report design view, what exactly do you have in these properties of
the
problem text box:
Control Source (Data tab)
Format (Format tab)
Name (Other tab)

ReadingOrder and NumericalShapes exist only in Access 2002 and later. If
you
are using these versions you should have:
ReadingOrder: Context.
NumericalShapes: System

Unicode is present in Access 2000 and later.
Do you have multiple languages installed?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Ken said:
Thanks for the post reply. I tried everything I could from your post.
Some
additional information in response to your questions,

1) I am only using ARIAL and TIMES NEW ROMAN fonts throughout all my
reports.
2) I do not understand what you are referring to when you say
READINGORDER
and NUMERICALSHAPES property settings. These do not exist as
properties
for
text boxes, at least not that I can see.
3) There sure might be confusion over 8-bit ASCII and unicode, I sure
am.
But I do not know how to check or fix this.
4) All the text in the calculated fields in my query are left aligned.
In
fact, all look to be text, as they should be.
5) What is the explicit function to ensure the calculated fileds return
a
test string? Is it CSTR?

I tried creating a new report with only the calculated field printed.
I
get
the same result, it prints to the report as a series of numbers and
letters
inside the { and } brackets.

When I simply open the query directly I see the field values exactly as
I
expect them. I am simply combining three text strings into another
text
string. The strings look like this "9573", "SP" and "REG" being
combined
into "9573SPREG".



:

This could be a display issue, a data type issue, or a corruption
issue.

Display
=====
What font is used in the report? Test with the basic fonts like Arial
or
Times New Roman.

Check the properties of the text box, e.g. ReadingOrder and
NumericalShapes.

Make sure there is nothing in the Format property of the text box that
would
force it to interpret the data differently than expected.

Any chance of confusion about whether this is 8-bit ASCII data or
Unicode
data?

Data type
=======
You say the calculation looks fine in the query.
Does it left-align (like text), or right-align (like numbers)?

Make sure there is nothing in the Format property of the text box in
the
query.

Try explicitly typecasting the result of the calcuation. For example,
if
you
have:
[Qty] * [PriceEach]
try:
CDbl(Nz([Qty] * [PriceEach], 0))
More info on this in:
Calculated fields misinterpreted
at:
http://allenbrowne.com/ser-45.html

Corruption
=======
If neither of the above proves fruitful, it is possible that:
a) the report is corrupt,
b) the data is corrupt,
c) Access is confused about what refers to what,
d) the code is corrupt.

Start by ensuring the Name AutoCorrect boxes are unchecked under:
Tools | Options | General
Then compact/repair the database. That could take care of (b) and (c).

(d) would apply only if the query or report calls a VBA function. If
so,
try
a decompile, followed by a compact.

To demonstrate (a), create another report based on this query, with
just
the
one field if you like. If this one works, you can develop it further
and
discard the bad one. (If the report is complex, you might be able to
rescue
it with the undocumented SaveAsText/LoadFromText.)

I have an Access 2000 database application that I am developing. The
problem is that in one of my queries I am calculating a string as a
combination of other strings. The calculation works fine and the
values
are as expected when I open the query. However, when I view the same
query
data in a report the calculated values appear as garbage. The values
look
like registry key values inside the {} brackets. Any idea as to what
might
cause this? Thanks.
 
Ken, you are right. It *is* a GUID. It is the ProductCode for Access.

Access 2000 introduced the ProductCode property of the Application object.
Access is therefore showing this GUID instead of the value of your field
named ProductCode. You can verify this by opening the code window, pressing
F2 to open the Object Browser, and searghing for ProductCode.

Rename the calculated field to something else in the query, and change the
name in the report.

Like Name and Date, it turns out that ProductCode is another bad field name.
I'm surprised I haven't seen this one before, as it is a really obvious name
to use for a field. It also means that any of the properties and methods of
the Application object are bad field names, so that's about 100 more to add
to the list of problem field names. I started developing a utility to find
bad field names once: there's about 700 of them!

Hope that gets you back on the road.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Allen Browne said:
Thanks, Ken. It's hard to see how Access could get this one wrong.

Is there anything else in the database that has the name ProductCode?

I presume you have already unchecked the Name AutoCorrect boxes under:
Tools | Options | General

Try changing the Name of the text box to the same as the field (i.e. drop
the txt prefix.) Then compact the database.

If that doesn't work, I would like to see this wonder. If it is small
enough to zip, email it to the address in the sig below, and I will try to
look at it tomorrow.

Ken said:
The problem textbox has the following settings,

Control Source = ProductCode (the name of the calculated field in
my
Query)
Format = (no setting)
Name = txtProductCode

And, the ProductCode filed in the Query has the following,

ProductCode: [Products]![ProductBaseCode] & [Products]![CustCode] &
[Products]![SizeCode]

where [Products] is a TABLE with the basic text data.

Regarding multiple languages, no I do not have this installed. Only
using
English.

One other piece of info which may be important is that I have developed
this
database on two PCs, one which has Access2000 and the other which has
Access2002 (ie. OfficeXP). On the 2002 machine I am saving the database
as
2000 format.

Allen Browne said:
Okay, you have a calculated field in your query.
Could you post this field please?
Presumably it says something like:
MyField: [Field1] & [Something] & [Another]

In report design view, what exactly do you have in these properties of
the
problem text box:
Control Source (Data tab)
Format (Format tab)
Name (Other tab)

ReadingOrder and NumericalShapes exist only in Access 2002 and later. If
you
are using these versions you should have:
ReadingOrder: Context.
NumericalShapes: System

Unicode is present in Access 2000 and later.
Do you have multiple languages installed?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Thanks for the post reply. I tried everything I could from your post.
Some
additional information in response to your questions,

1) I am only using ARIAL and TIMES NEW ROMAN fonts throughout all my
reports.
2) I do not understand what you are referring to when you say
READINGORDER
and NUMERICALSHAPES property settings. These do not exist as
properties
for
text boxes, at least not that I can see.
3) There sure might be confusion over 8-bit ASCII and unicode, I sure
am.
But I do not know how to check or fix this.
4) All the text in the calculated fields in my query are left aligned.
In
fact, all look to be text, as they should be.
5) What is the explicit function to ensure the calculated fileds
return a
test string? Is it CSTR?

I tried creating a new report with only the calculated field printed.
I
get
the same result, it prints to the report as a series of numbers and
letters
inside the { and } brackets.

When I simply open the query directly I see the field values exactly
as I
expect them. I am simply combining three text strings into another
text
string. The strings look like this "9573", "SP" and "REG" being
combined
into "9573SPREG".



:

This could be a display issue, a data type issue, or a corruption
issue.

Display
=====
What font is used in the report? Test with the basic fonts like Arial
or
Times New Roman.

Check the properties of the text box, e.g. ReadingOrder and
NumericalShapes.

Make sure there is nothing in the Format property of the text box
that
would
force it to interpret the data differently than expected.

Any chance of confusion about whether this is 8-bit ASCII data or
Unicode
data?

Data type
=======
You say the calculation looks fine in the query.
Does it left-align (like text), or right-align (like numbers)?

Make sure there is nothing in the Format property of the text box in
the
query.

Try explicitly typecasting the result of the calcuation. For example,
if
you
have:
[Qty] * [PriceEach]
try:
CDbl(Nz([Qty] * [PriceEach], 0))
More info on this in:
Calculated fields misinterpreted
at:
http://allenbrowne.com/ser-45.html

Corruption
=======
If neither of the above proves fruitful, it is possible that:
a) the report is corrupt,
b) the data is corrupt,
c) Access is confused about what refers to what,
d) the code is corrupt.

Start by ensuring the Name AutoCorrect boxes are unchecked under:
Tools | Options | General
Then compact/repair the database. That could take care of (b) and
(c).

(d) would apply only if the query or report calls a VBA function. If
so,
try
a decompile, followed by a compact.

To demonstrate (a), create another report based on this query, with
just
the
one field if you like. If this one works, you can develop it further
and
discard the bad one. (If the report is complex, you might be able to
rescue
it with the undocumented SaveAsText/LoadFromText.)

I have an Access 2000 database application that I am developing.
The
problem is that in one of my queries I am calculating a string as a
combination of other strings. The calculation works fine and the
values
are as expected when I open the query. However, when I view the
same
query
data in a report the calculated values appear as garbage. The
values
look
like registry key values inside the {} brackets. Any idea as to
what
might
cause this? Thanks
 
That utility I referred to is not properly debugged yet, but in case it
helps anyone you can download it here:
http://allenbrowne.com/unlinked/DbIssueChecker.zip

For Access 2000 and later.
70kb.
Checks for any combination of these issues:
- bad characters in table/field names (with the option to ignore spaces),
- table/field names that are reserved words or likely to cause problems (now
including ProductCode),
- tables that cannot be opened (e.g. attached tables where the file is now
gone),
- tables without a primary key,
- relationships with no enforced integrity.

Needs more work yet, e.g.:
- Does not open secured databases.
- May not handle parameter queries well.
- Needs restarting before you examine a 2nd database.

But I'm currently working on Acces 2007, so it not likely to get any
attention in the near future.
 
Allen Browne said:
That utility I referred to is not properly debugged yet, but in case it helps
anyone you can download it here:
http://allenbrowne.com/unlinked/DbIssueChecker.zip

<rant>

Most other environments with reserved words will automatically color them
different, bracket them, issue a warning, or flat out refuse to let you use them
by raising an error. Access/VBA should have the same OR they should have
prefixed all of their internal reserved words with a few characters that would
make the chance of a user hitting that same string extremely unlikely.

Obviously the latter option (the better one I think) would need to have happened
several versions back. Backward compatibility issues would make that difficult
now.

</rant>
 
Back
Top