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 2026
"jj" <jj@test.net> wrote in message
news:Cx******** ***********@twi ster.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!M axNum + 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******** ***********@twi ster.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*********@ho tmail.com> wrote in message
news:2n******** ****@uni-berlin.de... Format(rstMax!M axNum + 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 takes length of string and
return a random string of that length??????
can i implement mechanism so that the random number generated is form a
list of characters i specify. e.g. suppose if i want to create a random
|
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, but a prime number
tester would also be nice. I'm dealing with numbers in the 10^6-10^8 range
so it would have to fairly efficient
Dag
|
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 without
strtol or s/printf function.
Thanks,
whatluo.
|
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
next is 7 = $1,3576.00
Here is my code but I cannot get it to work.
public static void ReturnFormattedNumber(object sender,
|
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 also assume that both PrefixMin and PrefixMax strings are same length and PrefixMax is greater than PrefixMin .
Function should return boolean value :
If InputNum is in the range of PrefixMin and PrefixMax function should return TRUE otherwise...
|
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 the proxy class of webservice and makes a synchronous call to webservice GetReport() op.
Here is the code snippet -
***************************************************************************************
wbFELIP.wsZProcessReport.ProcessReport...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |