Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old January 26th, 2004, 01:16 AM
gazember gazember is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 11 gazember User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
digit problems! Please help!

Hi there Everyone!

I have the following problem, please try tol help if you can!

I am a (very) lame newbee and I can't code!!! Please explain how could I solve this problem!

I try to make the Customer ID (which is also the primary key and it is set to autonumber) to look like this 0001, 0002, 003,.. 0009, 0010,0011… 0100, 0101.. and so on.
On the format of the Customer ID I wrote this:”>> 0000” (without quotations)
My problem is that this autonumber should work this way: 0008, 0009, 0010, 0011.
But this way unfortunatelly it works this way: 0008, 0009, 00010, 00011. I hope you understand my problems. What’s wrong??

Thanx a lot in advance!

Reply With Quote
  #2  
Old January 26th, 2004, 07:33 AM
rletanab rletanab is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Philippines
Posts: 21 rletanab User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to rletanab
In that case you have to use a condition (nested if else or case statement). I think thats the only way you can control the data.

In your example you have 0008,0009,0010 which is supposed to be the output but instead you get 00010. The reason is you add 3 zeros(000) which gives a 5 digits number in return. Eg. 10 will surely display 00010 not 0010.

try the following
'num variable holding the length of the data
'result final output

select case len(num)
case 2
result = "000" & num
case 3
result ="00" & num
case 4
result = "0" & num
end select


Cheers

Reply With Quote
  #3  
Old January 26th, 2004, 09:04 AM
gazember gazember is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 11 gazember User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
where should I paste it?

Thanx a lot for your answer but please also tell me where should I paste the following code because I dont know where should I paste it!

select case len(num)
case 2
result = "000" & num
case 3
result ="00" & num
case 4
result = "0" & num
end select

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > digit problems! Please help!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway