UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Select Case code    
 
   
minnesota1972
post Nov 10 2004, 03:38 PM
Post #1

UtterAccess Veteran
Posts: 473
From: Vancouver BC, Canada



Hi to all

My select code doesn't seem to work.

Select Case Me!DAName.Value
Case is = "#"
[DAName] = "00" + [DAName]
Case Is = "##"
[DAName] = "0" + [DAName]
End Select

I'm trying to reformat my numbers. (The hard way). I've got it to work with one case as an if statement
If [DAName] Like "#" Then
[DAName] = "00" + [DAName]
End If

What's wrong with my select case? I know it's probably somewhere in the
Select Case Me!DAName.Value
or it might be in the
Case is = "#"

John
Go to the top of the page
 
+
AJS
post Nov 10 2004, 03:42 PM
Post #2

UtterAccess VIP
Posts: 3,893
From: Lansing, Michigan, USA



Well, your Case Is statements aren't checking for a single digit -- you'd need to use Like for that, as you found out. I take it this is bound to a text field. Otherwise, leading zeroes would not matter.

Why don't you simply use something like:
CODE
If isNumeric(Me.DAName) then
   Me.DAName = Format(Me.DAName, "000")
End If


This would change any numeric values to at least three digits, while leaving Non-numeric values unchanged.

hope this helps
-AJ
Go to the top of the page
 
+
minnesota1972
post Nov 10 2004, 03:54 PM
Post #3

UtterAccess Veteran
Posts: 473
From: Vancouver BC, Canada



Hi Evil Skeleton King!

WOW!

Thanks for the help. I didn't know about that "isnumeric" thing. That actually works a lot better! I bow to the Evil Skeleton King. All hail the Evil Skeleton King! That sure is some real fine tastey code from the Evil Skeleton King!

Seriously, thanks

John
Go to the top of the page
 
+
erwardell
post Nov 10 2004, 03:54 PM
Post #4

VIP Emeritus
Posts: 1,340



Why not just go into the table and in the format section of the field property put in 000. This will effect all entries in that field.
Go to the top of the page
 
+
AJS
post Nov 10 2004, 03:55 PM
Post #5

UtterAccess VIP
Posts: 3,893
From: Lansing, Michigan, USA



You're welcome. I'm glad to help. and glad it works for you. I was just kinda guessing as to what you needed.

-AJ
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th June 2013 - 01:43 AM