|
-
Apr 27th, 2000, 03:38 AM
#1
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
-
Apr 27th, 2000, 04:16 AM
#2
Hyperactive Member
I have only one idea. In Access open design of your table and create Input Mask for this field.
-
Apr 27th, 2000, 09:52 PM
#3
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
-
Apr 27th, 2000, 11:55 PM
#4
Hyperactive Member
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)?
-
May 1st, 2000, 11:21 PM
#5
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|