Hi John,
The update query based on the VBA function deleted not only the special
character but all records (alpha & number) that matched the criteria....
"John Spencer" wrote:
> There is no built-in function to do this. You would need to create a
> custom VBA function to examine each character and keep just the ones you
> want.
>
> Public Function fStripToLtrNum(strIn)
> Dim strOut as String
> Dim iPos as Long
>
> If Len(StrIn & "") > 0 then
> For iPos = 1 to Len(StrIN)
> If Mid(strIn,iPos,1) Like "0-9A-z" then
> strOut = strOut & Mid(strIn,iPos)
> End If
> Next iPos
> End If
>
> If Len(StrOut) = 0 Then
> fStripToLtrNum = Null
> Else
> fStripToLtrNum = StrOut
> End If
> End Function
>
> Your update query might look like the following
> UPDATE YourTable
> SET IDNo = fStripToLtrNum([IdNo])
> WHERE IdNO Like "*[!0-9A-z]*"
>
> '====================================================
> John Spencer
> Access MVP 2002-2005, 2007-2008
> The Hilltop Institute
> University of Maryland Baltimore County
> '====================================================
>
>
> zyus wrote:
> > Sorry John for my blur explaination...
> >
> > You're right that the query that i meant is update query and not delete query.
> >
> > I have a field name IDNO(text) that consist records with special character
> > such as - / + spacing + and etc.
> >
> > What i want to do is to delete all the special character leaving only alpha
> > and number only.
> >
> > I've used this function Replace([IDNO],"-","") in update query but i've to
> > trigger every each special character (spacing) that i can expect.
> >
> > I used access for data reporting and analysis and i've to use the update
> > query to clean the IDNO field.
> >
> > Is there any trick where i can just trigger one function that can delete all
> > the special character.
> >
> > Hope this is clear
> >
> > "John W. Vinson" wrote:
> >
> >> On Mon, 3 Nov 2008 16:38:02 -0800, zyus <(E-Mail Removed)>
> >> wrote:
> >>
> >>> In a delete query...how to delete any special character in a field...
> >>>
> >>> Special character could be :;,.-\ / + etc...
> >>>
> >> A Delete query does NOT delete characters in a field!!!!! It deletes *entire
> >> records*.
> >>
> >> I think what you want is an Update query. It'll be a somewhat complicated one
> >> since you are painting with a broad brush here. Could you explain the actual
> >> contents of the field, and what final result you want, perhaps with some
> >> examples?
> >> --
> >>
> >> John W. Vinson [MVP]
> >>
>
|