-
I'm having the following problem with Access 97 and VB:
I'm using a TableDef to change the default values of various
fields in the database. The fields are text fields, 255
characters max, allowing empty strings, and not required.
I'm assigning the .fields(X).defaultvalue property to the
.text property of a listBox.
If I change the default value to an alpha string like
"Platinum", then it works fine. However, if I use a string
which begins with a number like "14 Karat" then I get a
Syntax error in "...table level validation".
Since this is obviously a program for a jeweler, most of the
strings will look like 14XXX or 18XXX or 22XXX.
The solution seems deceptively simple. Can anyone help?
-John
-
I have only one idea. In Access open design of your table and create Input Mask for this field.
-
That doesn't do it. By leaving the input mask blank it allows any input to the field(I think). Anyway, I can't type the string 14K into the default value box even if I try to do it right in Access. Try it yourself, it's pretty odd.
-John
-
When are you typing in the default box, do you inclose your string in double quotes? Like "14K". Do you have any validation for this field in Access( validation text, validation rule)?
-
LG-
I finaly got it solved, but i had to use
myTableDef.defaultvalue = chr(34) & "14K" & chr(34)
to get the quotes into Access properly. I need a refresher
on escaping quotes in strings, I guess. Thanks for the
help on this.
-John