Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Within the first afternoon I found 2 of the 3 needed solutions, and the 3rd came to me over the weekend!..."

Geography

Where in the world do Tek-Tips members come from?
hpl2001 (Programmer)
8 Jun 12 9:21
Hi:

I have a field that has values such as : 12, 12A, 123B.... That field is an alphanumeric, and is also part of the key. I have one report that need to be sorted numerically by the data in this field. The only way I can think to do this is to create 2 new fields to hold the number and the letter separately (there will not always, or even often, be a letter). Then I will sort the table by the number field then the letter field to get the desired result.

So my question is...how to write code to take that alphanumeric entry, and split it into the number and the letter to store them in the new fields?

Tia.

Holly
dhookom (Programmer)
8 Jun 12 9:42
This expression will return the number:

CODE --> expression

Val("123V")
This expression will return the text

CODE --> expression

Mid("123V",Len(str(Val("123V"))))

Duane
Hook'D on Access
MS Access MVP

hpl2001 (Programmer)
8 Jun 12 10:09
Okay, so here's how I've tried to implement this, but I am getting error 2465 on my 2 new lines. The rest of the code is pre-existing and works on its own:
------------
Select Case Ans
Case vbYes
If (IsNull(Me.Year) Or IsNull(Me.Box_Number) Or IsNull(Me.Schedule_Number) Or IsNull(Me.Facility) Or IsNull(Me.Transfer_Number)) Then
MsgBox ("Year, Box Number, Facility, Schedule Number and Transfer Number are required"), vbOKOnly
Exit Sub
Else
[Last Update] = Now()
[User Name] = Environ("Username")
NEW LINE==> [Box Numeric] = Val(Me.Box_Number)
NEW LINE==> [Box Alpha] = Mid(Me.Box_Number, Len(Str(Val(Me.Box_Number))))
MsgBox ("Box Saved"), vbOKOnly
End If
Case vbNo
Me.Undo
Case vbCancel
Cancel = True
Exit Sub
End Select
----------------

Am I making some sort of syntax error?
hpl2001 (Programmer)
8 Jun 12 11:04
Got it...

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close