Chr() not working in Forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a control in one of my forms that combines the street, city, state,
and zip fields from the same form, and formats them like you would for a
mailing label. The control is called [Full_Address] and here is the equation
it uses:

=[Street] & Chr(13) & Chr(10) & [City] & ", " & [State] & " " & [Zip]

The Problem:
I program with MS Access 2002 on two computers. On Computer1 the above
formula works fine but on Computer2 the formula reads #Name? and I get the
following error message: "The object doesn't contain the Automation object
'Chr'."

I didn't find this out until after I did some design work on my evil
Computer2. Now the Chr() function does not work for this form on EITHER
computer. I've even tried creating a new [Full_Address2] control on Computer1
but with no success.

Anyone know why this happens? Isn't Chr() a pretty standard function? Any
suggestions what I can do to fix it?
 
It could be a problem with the References collection\.

References problems can be caused by differences in either the location or
file version of certain files between the machine where the application was
developed, and where it's being run (or the file missing completely from the
target machine). Such differences are common when new software is installed.

On the machine(s) where it's not working, open any code module (or open the
Debug Window, using Ctrl-G, provided you haven't selected the "keep debug
window on top" option). Select Tools | References from the menu bar. Examine
all of the selected references.

If any of the selected references have "MISSING:" in front of them, unselect
them, and back out of the dialog. If you really need the reference(s) you
just unselected (you can tell by doing a Compile All Modules), go back in
and reselect them.

If none have "MISSING:", select an additional reference at random, back out
of the dialog, then go back in and unselect the reference you just added. If
that doesn't solve the problem, try to unselect as many of the selected
references as you can (Access may not let you unselect them all), back out
of the dialog, then go back in and reselect the references you just
unselected. (NOTE: write down what the references are before you delete
them, because they'll be in a different order when you go back in)

You might also fully qualify the Chr function (VBA.Chr(13), rather than just
Chr(13)), so that Access doesn't have to read through all of the references
trying to find the specific function. However, while that should solve the
symptom, it won't solve the underlying problem.
 
Wow it's weird that removing a MISSING reference would correct the problem
but it did. I don't get it but I don't think I'm supposed to. Thanks Doug,
your're the man.

Douglas J. Steele said:
It could be a problem with the References collection\.

References problems can be caused by differences in either the location or
file version of certain files between the machine where the application was
developed, and where it's being run (or the file missing completely from the
target machine). Such differences are common when new software is installed.

On the machine(s) where it's not working, open any code module (or open the
Debug Window, using Ctrl-G, provided you haven't selected the "keep debug
window on top" option). Select Tools | References from the menu bar. Examine
all of the selected references.

If any of the selected references have "MISSING:" in front of them, unselect
them, and back out of the dialog. If you really need the reference(s) you
just unselected (you can tell by doing a Compile All Modules), go back in
and reselect them.

If none have "MISSING:", select an additional reference at random, back out
of the dialog, then go back in and unselect the reference you just added. If
that doesn't solve the problem, try to unselect as many of the selected
references as you can (Access may not let you unselect them all), back out
of the dialog, then go back in and reselect the references you just
unselected. (NOTE: write down what the references are before you delete
them, because they'll be in a different order when you go back in)

You might also fully qualify the Chr function (VBA.Chr(13), rather than just
Chr(13)), so that Access doesn't have to read through all of the references
trying to find the specific function. However, while that should solve the
symptom, it won't solve the underlying problem.


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



HM said:
I have a control in one of my forms that combines the street, city, state,
and zip fields from the same form, and formats them like you would for a
mailing label. The control is called [Full_Address] and here is the
equation
it uses:

=[Street] & Chr(13) & Chr(10) & [City] & ", " & [State] & " " & [Zip]

The Problem:
I program with MS Access 2002 on two computers. On Computer1 the above
formula works fine but on Computer2 the formula reads #Name? and I get the
following error message: "The object doesn't contain the Automation object
'Chr'."

I didn't find this out until after I did some design work on my evil
Computer2. Now the Chr() function does not work for this form on EITHER
computer. I've even tried creating a new [Full_Address2] control on
Computer1
but with no success.

Anyone know why this happens? Isn't Chr() a pretty standard function? Any
suggestions what I can do to fix it?
 
References are like apples: one bad one can spoil the whole barrel.

What happens is that Access searches through all of the selected references,
looking for the function you're trying to use. If any of the references are
broken, that prevents Access from completing its search.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



HM said:
Wow it's weird that removing a MISSING reference would correct the problem
but it did. I don't get it but I don't think I'm supposed to. Thanks Doug,
your're the man.

Douglas J. Steele said:
It could be a problem with the References collection.

References problems can be caused by differences in either the location
or
file version of certain files between the machine where the application
was
developed, and where it's being run (or the file missing completely from
the
target machine). Such differences are common when new software is
installed.

On the machine(s) where it's not working, open any code module (or open
the
Debug Window, using Ctrl-G, provided you haven't selected the "keep debug
window on top" option). Select Tools | References from the menu bar.
Examine
all of the selected references.

If any of the selected references have "MISSING:" in front of them,
unselect
them, and back out of the dialog. If you really need the reference(s) you
just unselected (you can tell by doing a Compile All Modules), go back in
and reselect them.

If none have "MISSING:", select an additional reference at random, back
out
of the dialog, then go back in and unselect the reference you just added.
If
that doesn't solve the problem, try to unselect as many of the selected
references as you can (Access may not let you unselect them all), back
out
of the dialog, then go back in and reselect the references you just
unselected. (NOTE: write down what the references are before you delete
them, because they'll be in a different order when you go back in)

You might also fully qualify the Chr function (VBA.Chr(13), rather than
just
Chr(13)), so that Access doesn't have to read through all of the
references
trying to find the specific function. However, while that should solve
the
symptom, it won't solve the underlying problem.


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



HM said:
I have a control in one of my forms that combines the street, city,
state,
and zip fields from the same form, and formats them like you would for
a
mailing label. The control is called [Full_Address] and here is the
equation
it uses:

=[Street] & Chr(13) & Chr(10) & [City] & ", " & [State] & " " & [Zip]

The Problem:
I program with MS Access 2002 on two computers. On Computer1 the above
formula works fine but on Computer2 the formula reads #Name? and I get
the
following error message: "The object doesn't contain the Automation
object
'Chr'."

I didn't find this out until after I did some design work on my evil
Computer2. Now the Chr() function does not work for this form on EITHER
computer. I've even tried creating a new [Full_Address2] control on
Computer1
but with no success.

Anyone know why this happens? Isn't Chr() a pretty standard function?
Any
suggestions what I can do to fix it?
 
Back
Top