Re: adding a text string to data from one field in one database to another
- From: Bob Quintal <rquintal@xxxxxxxxxxxxx>
- Date: 11 Sep 2006 09:30:35 GMT
sellcraig@xxxxxxx wrote in
news:1157936291.383155.321180@xxxxxxxxxxxxxxxxxxxxxxxxxxx:
1 validation for code field
If I want the code field to contain only test or numbers -
(NO symbols - ie: /? -;+=space) and also text only in lower
case only. The data in the code field contains product
codes of various lengths I think there are two was I can
think of this working, 1) Not permitting the text to be
entered upon entry. using some validation rule
2) Ignoring the non accepted info and correcting to
lower case when leaving field. Ie: wAsrH 12-4 becomes
wasrh124
I looked at
Validation rule suspect- StrConv([code], 2) plus a
function that blocks anything but numbers or letters. ( I
do not know which one) Format do not know
Input mask do not know
I also want to make the field a unique field eliminating
any duplicates of the item code being entered twice.
I strongly suggest UPPERCASE letters, for technical
reasons... I would put this in VB code in the textbox
AfterUpdate event.
private sub ItemCode_AfterUpdate() as string
Dim stAllowedChars as string
dim stFrom as string stTo as string
dim iPtr as integer.
stAllowedChars ="ABCDEFGHJKLMNPRTUVWY0123456789"
'do not allow IOQSXZ, they can be confused with numbers.
stFrom = me.Itemcode.value
For iPtr = 1 to len(stFrom)
If instr(1,stAllowedChars,mid(stFrom,iptr,1))>0 then
stTo = stTo & ucase(mid(stFrom,iptr,1))
end if
next iPtr
me.Itemcode.value = stTo
end sub
What if I am not using forms?
How will you be entering data? If you intend to allow entry of
part numbers in the table, you are doing something dangerous.
If you are planning to import from a file generated outside of
Access, then place the code in a user defined function, and call
that function in a query
and the data needs to be lower case with all charactersbecause they are part numbers? The D.O.D. in the usa and NATO
because they are part numbers and also will be part of an web
address address and some sites do not support capitals and
lower case letters as the same.
High Command require part numbers in UPPERCASE only, with the
letters excluded as shown in my code.
Some sites? not many, as the web has evolved. If you still
insist, then add one function to the code to convert the string
to lowercase
Change from
me.Itemcode.value = stTo
To
me.Itemcode.value = StrConv([stTo], 2)
--
Bob Quintal
PA is y I've altered my email address.
--
Posted via a free Usenet account from http://www.teranews.com
Warning: Do not use Ultimate-Anonymity
They are worthless spammers that are running a scam.
.
- References:
- Re: adding a text string to data from one field in one database to another
- From: Bob Quintal
- Re: adding a text string to data from one field in one database to another
- From: sellcraig
- Re: adding a text string to data from one field in one database to another
- From: Bob Quintal
- Re: adding a text string to data from one field in one database to another
- From: sellcraig
- Re: adding a text string to data from one field in one database to another
- Prev by Date: Is there any way to find out the width of a closed report programatically?
- Next by Date: Re: Is there any way to find out the width of a closed report programatically?
- Previous by thread: Re: adding a text string to data from one field in one database to another
- Next by thread: Re: adding a text string to data from one field in one database to another
- Index(es):
Relevant Pages
|