example is I'm finding the max number within a certain criteria, and then
adding one to that. However, most IDs are something like K00001 or R00223
So I want the next ID to be either K00002 or R00224
Unfortunately Access is stripping out the leading 0s leaving me with an ID
of K3 or R224.
With PHP I'm able to do something like:
$newid = str_pad($row[0] + 1, 5, "0", STR_PAD_LEFT);
To make sure the ID is always 5 chars. Here's part of what I have in my
INSERT statement now:
'" & Left(rst!IDNUM, 2) & rstMax!MaxNum + 1 & "'
So it'd be nice to have something like:
'" & Left(rst!FIDNUM, 2) & newid & rstMax!MaxNum + 1 & "' (where newid is
the padded 0s if necessary)
Is there such a thing I can do in Access/VB? 3 1999
"jj" <jj@test.net> wrote in message
news:Cx*******************@twister.rdc-kc.rr.com... example is I'm finding the max number within a certain criteria, and then adding one to that. However, most IDs are something like K00001 or R00223
So I want the next ID to be either K00002 or R00224
Unfortunately Access is stripping out the leading 0s leaving me with an ID of K3 or R224.
With PHP I'm able to do something like: $newid = str_pad($row[0] + 1, 5, "0", STR_PAD_LEFT);
To make sure the ID is always 5 chars. Here's part of what I have in my INSERT statement now:
'" & Left(rst!IDNUM, 2) & rstMax!MaxNum + 1 & "'
So it'd be nice to have something like:
'" & Left(rst!FIDNUM, 2) & newid & rstMax!MaxNum + 1 & "' (where newid is the padded 0s if necessary)
Is there such a thing I can do in Access/VB?
Format(rstMax!MaxNum + 1,"00000")
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Hi, JJ.
You can use the Format function to pad leading zeros on a value that has a
varying number of digits. For an example, see "How to format a string with
varying numbers of leading zeros" on this Web page: http://www.access.qbuilt.com/html/vba.html
HTH.
Gunny
See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.
"jj" <jj@test.net> wrote in message
news:Cx*******************@twister.rdc-kc.rr.com... example is I'm finding the max number within a certain criteria, and then adding one to that. However, most IDs are something like K00001 or R00223
So I want the next ID to be either K00002 or R00224
Unfortunately Access is stripping out the leading 0s leaving me with an ID of K3 or R224.
With PHP I'm able to do something like: $newid = str_pad($row[0] + 1, 5, "0", STR_PAD_LEFT);
To make sure the ID is always 5 chars. Here's part of what I have in my INSERT statement now:
'" & Left(rst!IDNUM, 2) & rstMax!MaxNum + 1 & "'
So it'd be nice to have something like:
'" & Left(rst!FIDNUM, 2) & newid & rstMax!MaxNum + 1 & "' (where newid is the padded 0s if necessary)
Is there such a thing I can do in Access/VB?
Wow, thank you so much for the quick response and easy fix!
"Rick Brandt" <ri*********@hotmail.com> wrote in message
news:2n************@uni-berlin.de... Format(rstMax!MaxNum + 1,"00000")
-- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: vishal |
last post by:
i want to generate a random number of a fixed length
so how can i do this ??
i know some function which returns a single random character at a time
but is there any built-in function which...
|
by: Dag |
last post by:
Is there a python module that includes functions for working with prime
numbers? I mainly need A function that returns the Nth prime number and
that returns how many prime numbers are less than N,...
|
by: whatluo |
last post by:
Hi, all
I'm now working on a program which will convert dec number to
hex and oct and bin respectively, I've checked the clc but with no
luck, so can anybody give me a hit how to make this done...
|
by: John S |
last post by:
I have created an event handler that is trying to format each number as it
is typed. Example
If the first char is 1 = output is $1.00
second char is 3 = output is $13.00
next is 5 = $135.00...
|
by: Niklas Engfelt |
last post by:
Does anyone have a nice algorithm/method to increase all digits one
step, e.g. 123123 to 234234 and 4444 to 5555 and 999999 to 000000?
Best regards
Niklas
|
by: ffrugone |
last post by:
I need to create a method for a web page I'm building that encrypts a
number from 1 to 1000 into a 4 digit hex code. I know nothing about
cryptography. Can anyone steer me in the right direction?
|
by: mailursubbu |
last post by:
Hi
How to write a program to get the factorial of 4096.
I am working on a Linux m/c.
Best Regards,
Subra
|
by: BonBoni |
last post by:
Hi everybody
I need to implement a function that receives the following parameters :
char *PrefixMin , char *PrefixMax , char *InputNum
All the input strings max length is 25 chars.
I can...
|
by: santoshsri |
last post by:
Hi All,
My C# web application calls a webservice to process a report. It sends XMLs as parameter and in response gets an XML node which stores Binay datatype bin.base64.
It makes an instance of...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |