Run-time error 13

S

SFC Traver

I have the following code:
Private Sub
WRIST_AVG = (WRIST_1 + WRIST_2 + WRIST_3) / 3
End Sub

I have the same basic code for neck, hips, forearms and they all work fine.
I have even used the "List Properties/Methods" right-click to make sure my
field names are right. What is wrong?
Thanks!
SFC T
 
K

Ken Snell \(MVP\)

What are WRIST_AVG, WRIST_1, WRIST_2, and WRIST_3? Are they variables? Where
do you declare them (Dim statements)? The error that you are getting
suggests that at least one of them is not of a numeric or variant type.
 
S

SFC Traver

All of them are text fields in my table. Tried changing them to numbers
(double), but that did not work. They are all the same type in the table and
the form. I am working on them in a form. Did not declare them, but I did not
declare any of the others (hips, neck, etc) either, and they work fine. Is it
because it ends up being the last sub in the form? A bit hazy on Dim
statements.
Thanks for the help
 
K

Ken Snell \(MVP\)

Doing multiplication, subtraction, or division with text data types will
give you that error (the plus sign is a special form of concatenation for
text strings).

If WRIST_AVG, WRIST_1, WRIST_2, and WRIST_3 are fields from the table, and
they are text data types, then you'll need to do something different in your
code.

You need to tell us more about your data structure and what you're doing in
the form.

As for Dim statements, they are explained in the Help files. You use them to
declare a variable to be of a specific data type, otherwise ACCESS assumes
that a variable is Variant type. Note that fields and variables are not the
same; you don't Dim a field in the code.
 
Top