Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / April 2005

Tip: Looking for answers? Try searching our database.

Stripping A character from a string

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Evan M - 28 Apr 2005 22:29 GMT
Hello,

I have a field that has a has a sequencial numbering system that began a A1
and is currently at A2500. I need to be able to sort these numerically when
the form opens. Does anyone have any suggestions?

Thanks,
Evan M
evan AT radiologyonesource DOT com
Jeff Boyce - 28 Apr 2005 22:58 GMT
Evan

Look into using the Mid() function to start at position #2 and use the
remainder.  A query that includes something like:
   Expr1: Mid([YourField],2)
would return all the characters after the first one.  You could then sort on
that field in the query.

Good luck

Jeff Boyce
<Access MVP>

> Hello,
>
[quoted text clipped - 5 lines]
> Evan M
> evan AT radiologyonesource DOT com
Evan M - 29 Apr 2005 00:05 GMT
Hi Jeff, Thanks for your reply. The character is properly stripped from the
ID, however when i sort the results in an "ascending" fashion, they begin
with 1, then follow with 10, 100, 1000, 1001... and so on. How is it that I
can sort them sequencially?

Thanks,
Evan M
evan AT radiologyonesource DOT com

> Evan
>
[quoted text clipped - 18 lines]
>> Evan M
>> evan AT radiologyonesource DOT com
Jeff Boyce - 29 Apr 2005 00:12 GMT
Sounds like they are characters, not numbers.  You may also have to convert,
after stripping, to a numeric data type.  Your expression might look
something like:

   Expr1: CInt(Mid([YourField],2))

Good luck

Jeff Boyce
<Access MVP>

> Hi Jeff, Thanks for your reply. The character is properly stripped from
> the ID, however when i sort the results in an "ascending" fashion, they
[quoted text clipped - 27 lines]
>>> Evan M
>>> evan AT radiologyonesource DOT com
Evan M - 29 Apr 2005 21:18 GMT
Hi Jeff,

I added the "CInt()" around the original code as you had reccomended,
however, now i receive a "Data-Type mismatch" error. Do you have any
suggestions about what may be happening?

Thanks,
Evan
evan AT radiologyonesource DOT com

> Sounds like they are characters, not numbers.  You may also have to
> convert, after stripping, to a numeric data type.  Your expression might
[quoted text clipped - 38 lines]
>>>> Evan M
>>>> evan AT radiologyonesource DOT com
Paul Overway - 29 Apr 2005 21:23 GMT
Use CLng instead of CInt

Signature

Paul Overway
Logico Solutions
http://www.logico-solutions.com

> Hi Jeff,
>
[quoted text clipped - 48 lines]
>>>>> Evan M
>>>>> evan AT radiologyonesource DOT com
Evan M - 29 Apr 2005 22:47 GMT
Hi Paul, Jeff,

I found the error - a user had modified two records and added an extra alpha
character to the strings: 1111A and 1111B. The A and B were causing the
problem. Thanks for both of your help!

Evan M
evan AT radiologyonesource DOT com

> Use CLng instead of CInt
>
[quoted text clipped - 50 lines]
>>>>>> Evan M
>>>>>> evan AT radiologyonesource DOT com
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.