473,498 Members | 1,992 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

make number generator in access

5 New Member
i need to make a generator for id in my database, this id need real time date, brand, no entry. for example,
for first item with brand Dex
real time date = 7813
brand = dex
no entry = 1
for second item with brand Dex
real time date = 7813
brand = dex
no entry = 2

if there's change in date or brand, no entry will start again in 1.

please for help. I really need yours help. Thank you before.
Aug 7 '13 #1
3 1708
jimatqsi
1,271 Recognized Expert Top Contributor
Van93, you're going to want to query the table containing this data for Max([no entry]) with where string criteria for the date and brand. That will return the highest value in the table for [no entry]. Add one to that to get your new entry number.

If there is no row matching the where string you'll have a null value for [no entry], so you'll need NZ([no entry],0) to convert the NULL to a zero and avoid an error.

You don't say if this is in a query or code behind a form. Knowing that would inform the discussion. I hope this gets you over the hump.

Also, you might pay attention to how you form the date value. 12113 could be Jan 21 or Dec 1.

Jim
Aug 7 '13 #2
zmbd
5,501 Recognized Expert Moderator Expert
(Sorry, this may cross post, had to step away.)


Lets work with your fields for the momemnt.
Let me rename them for just a little bit.
[realtimedate]; [brand]; [SeqNum]

What you describe will do something like this
(take special note of lines 7,8, and 9:
Expand|Select|Wrap|Line Numbers
  1. [realtimedate]; [brand]; [SeqNum]
  2.      7813        Dex     0001
  3.      7813        Dex     0002
  4.      7813        Dex     0003
  5.      7813        New     0001
  6.      7813        New     0002
  7.      7813        New     0003
  8.      7813        Dex     0001
  9.      7813        Dex     0002
I suspect you want something like the following for a given [realtimedate]:
Expand|Select|Wrap|Line Numbers
  1. [realtimedate]; [brand]; [SeqNum]
  2.      7813        Dex     0001
  3.      7813        Dex     0002
  4.      7813        Dex     0003
  5.      7813        New     0001
  6.      7813        New     0002
  7.      7813        New     0003
  8.      7813        Dex     0004
  9.      7813        Dex     0005
(Once Again: take special note of lines 7,8, and 9)


Reseting the [SeqNum] when the date changes so from 7813 to 7814 for a given brand

is this more what you are after?
Aug 7 '13 #3
van93
5 New Member
Thank you guys for the answer. for ZMBD, i've tried to make the second one but actually i need to make the first one... can you help me for the coding... i can't do that... thank you...
Aug 9 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
4464
by: Joe Wong | last post by:
Hi, I need to implement a unique number generator that 1 or more processes on same or different machines will make use of it. Is there any library / project available already for this? Thanks...
22
433
by: Alan Lee | last post by:
Is there any way to set RAND_MAX in rand()? I am looking for a way to get a random number between 1 and 1E9. So far I can't figure out how to do that. any suggestions would be greatly appreciated.
70
6168
by: Ben Pfaff | last post by:
One issue that comes up fairly often around here is the poor quality of the pseudo-random number generators supplied with many C implementations. As a result, we have to recommend things like...
2
1768
by: jerryau | last post by:
Hi, I'm creating a number generator program, that is supposed to generate 6 unique random numbers for each game. I want to generate this for 6 games. The problem is, that it works for the...
5
3322
by: Peteroid | last post by:
I know how to use rand() to generate random POSITIVE-INTEGER numbers. But, I'd like to generate a random DOUBLE number in the range of 0.0 to 1.0 with resolution of a double (i.e., every possible...
9
16723
by: L33VaNcL33F | last post by:
I like to make a javascript that generate random number from the range number within : (10016486 and 99999985). the number always + 22423 that begin from 10016486 and end at 99999985 Example...
2
11098
by: masker | last post by:
I was on the web trying to find a javascript that would allow me to input a number on my website and have it increase by a given percentage every second. During my search I found the Earth...
4
2152
by: tigger | last post by:
Hi there, i'm using random number generator to generate random numbers between 40 to 50. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles...
4
14711
by: Lexicon | last post by:
Hello; Does anyone know a 64-bit integer generator for 32-bit machines that use long long or __int64 etc ?
3
4414
AccessQuestion
by: AccessQuestion | last post by:
So just a quick question; more out of curiosity than anything. I have a form in which I pop a random number into a text box. Eventually that number will be placed by a user using a scale, but I...
0
7203
jinu1996
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...
0
7379
tracyyun
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...
0
5462
agi2029
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,...
1
4908
isladogs
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...
0
4588
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3093
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...
0
3081
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
290
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.