473,657 Members | 2,554 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting up an automatic but customized ID

Good day guys...

I must say this forum is quite of useful one. I really appreciate what
you guys are doing and I hope it will continue on.
I have few questions that needs some help.

1. I want to know how do you create a primary key that increment
itself but with a specified format. Say s3075711 something like that.
I doesn't have to be like that but similar to it. And for distributed
database, is it possible to say, give a certain range of unique
primary key to a person and another range of primary keys to another
person? (Just to not make it overcomplex, just answer the first one..)
2. How do you design Access so that it can be used as a distributed
database? I have a group that is expanding in size (non-profit), and
it require more than one data populator to populate the database.

Thank you again for all your help. And if you can give me a reference
with which I can find the answers to my questions, I would be very
thankful.

Kind Regards
Erwin K

Jun 15 '07 #1
7 2490
CodeGunnerLev1 wrote:
Good day guys...

I must say this forum is quite of useful one. I really appreciate what
you guys are doing and I hope it will continue on.
I have few questions that needs some help.

1. I want to know how do you create a primary key that increment
itself but with a specified format. Say s3075711 something like that.
I doesn't have to be like that but similar to it. And for distributed
database, is it possible to say, give a certain range of unique
primary key to a person and another range of primary keys to another
person? (Just to not make it overcomplex, just answer the first one..)
Is is really necessary to make that field the primary key? You could
use an autonumber (always visible = false) and have another that is your
calculated key.

You would not want to use an autonumber field. Since it uses alphas, it
would need to be text.

I would create a table. Maybe call it TableKeys. In it have a field
called KeyNum. Init the field with some value. When you open the form,
you would 1) Get the current value, 2) store that value to a variable 3)
Increment the number, 4) update the TableKeys field with the new value,
then add whatever additional stuff you need to make it unique (like
adding the S).

Autonumbers, tho sequential in nature, may have breaks in them. This
can be caused by starting to add a record than aborting the add for example.

So you need to consider when you want to create the key. Perhaps when
the record is saved...in the form's BeforeUpdate event. That way you
can keep the record numbers sequential. Or you can create it when you
go to a new record. Then if you abort the add, check the tablekeys
table to see if the number is the same and decrement it.

I think if you want to give keys to others, you should do either one or
the other...sequent ial numbers for all or sequential numbers for users.
You don't want to be doing two sets of code.

You will need a method to get the user name/ID. See
http://www.mvps.org/access and check the API's for getting user name.
Or get the username if you have Access security set on.

If you give sequential numbers to users, you need a method to add a user
and his sequential number set.

Overall, I would use an autonumber field and make this calced key an
indexed field. A key is a key is a key. You can "prettify" the key for
them for presentation but use the autonumber as the real key.

2. How do you design Access so that it can be used as a distributed
database? I have a group that is expanding in size (non-profit), and
it require more than one data populator to populate the database.
What do you mean by "distribute d database"? Are the people on the same
network? Or is the app located at multiple locations but all share the
same data? Are you talking about a replicated database? I don't know
what a data populator is.
>
Thank you again for all your help. And if you can give me a reference
with which I can find the answers to my questions, I would be very
thankful.
The help file is a start.

Next...http://groups.google.com/advanced_search?q=&
In the Groups text box enter *access*
Then enter what words you want to search for.

http://www.mvps.org/access

Some access programmers have taken the time to put together some Access
tips to help. Here's two of them.
http://www.granite.ab.ca/accsmstr.htm
http://allenbrowne.com/tips.html
Kind Regards
Erwin K
Jun 15 '07 #2
wow... I need time to digest that.. I guess.

I sort of get it first go, but I need to read it again. What I meant
by distributed database is more like the application is located in
multiple locations but all share the same data.

The ID numbers act as an identifier is like a membership number. It
doesn't necessarily need to have s or alpha's. It can be all numbers
only. I was thinking of using a code to generate the number in a form.
Would that work? And what sort of language do I need to know to make
that? :P VB or Macro?

Thank you for your reply.
Jun 15 '07 #3
CodeGunnerLev1 wrote:
wow... I need time to digest that.. I guess.

I sort of get it first go, but I need to read it again. What I meant
by distributed database is more like the application is located in
multiple locations but all share the same data.
Do they run separately (iow on a PC not connected to the network or not
on a wan or whatever)? You might have to think about replication then
but I really don't know what your current situation is yet.

Replication would be for something like going out into the field and
collecting data on a laptop and then updating the database with changed
data when you get back to the office. (Look at the mvps.org link and
click on the search button for Replication of that is needed.)

So do you need replication or am I not understanding how the data will
be updated or shared...since they share the same data...whatever same
data is.
The ID numbers act as an identifier is like a membership number. It
doesn't necessarily need to have s or alpha's. It can be all numbers
only. I was thinking of using a code to generate the number in a form.
Would that work? And what sort of language do I need to know to make
that? :P VB or Macro?
Yes, that would work. Macro would be worthless. You need to understand
VBA. Fortunately for you, there's not many commands you'd need to
learn. Left, Right, Mid, Trim, String functions are a few.
>
Thank you for your reply.
Jun 15 '07 #4
Alright guys, I gotta be honest with you...

I've only been using Java and C++. And I am not quite confident of
using VBA on Access. Where can I find references with which I can
study.
In regards to the distributed database, yes I had replication in mind,
but there is a problem of primary key. If I could somehow make it work
(the primary key) how do I set the database so that, when - say two
database is joined - the primary keys wont be duplicated? One way of
doing it is to take some of the idea given by salad, that is making a
table to somehow control the designation of primary keys, and then
distribute it to different people. What do you guys think about this?

Thank you.

Jun 16 '07 #5
CodeGunnerLev1 wrote:
Alright guys, I gotta be honest with you...

I've only been using Java and C++. And I am not quite confident of
using VBA on Access. Where can I find references with which I can
study.
Irrelevent. If you can program in Java and C++ then you should have a
clue about event programming. And even the most basic programmer can do
string manipulation.
In regards to the distributed database, yes I had replication in mind,
but there is a problem of primary key. If I could somehow make it work
(the primary key) how do I set the database so that, when - say two
database is joined - the primary keys wont be duplicated? One way of
doing it is to take some of the idea given by salad, that is making a
table to somehow control the designation of primary keys, and then
distribute it to different people. What do you guys think about this?

Thank you.
I don't want to be an asshole but I doubt you've taken any of my advice
and gone to any of the links I provided you. I think you are expecting
someone to come down from heaven and give you all the answers as you
lounge on a couch eating grapes. You really should do some research.
Do not expect others to do the work for you. When you do your research
and read the white papers on replication you can pose questions that
will help get you over the hump.

I have not done replication. It may be best you start another thread
asking for pointers in replication...a fter doing some research.

Michka Kaplan either wrote, designed, or had significant input at MS on
replication. He was a poster in this newsgroup for years. I suggest
you go to http://www.mvps.org/access and search on replication and get
his software tool.

Next, get to google groups and follow my instructions on how to search
for messages. Look for message on replication and string manipulation.

Next, open up Access, go to help, and enter Replication. Study the topics.

Next, go to http://support.microsoft.com and look for topics on
replication for Access in the help file.

You might want to go to a bookstore and see if they have any books on
Access that discuss replication. Best bet is the Access Develpers
Handbook by Getz.

Good luck.
Jun 16 '07 #6
Wow mate I guess you're right.

I probably did expect something to come from heaven and help me out.
Its probably just my lack of confidence on these sort of stuff...
Anyways, I will follow your suggestions, and questions no more. Unless
of course I have a new problem unsolved...

And Salad, I very much thank you for your advice and pointers. Forgive
me for taking too much of your time and effort.

Jun 17 '07 #7
CodeGunnerLev1 wrote:
Wow mate I guess you're right.

I probably did expect something to come from heaven and help me out.
Its probably just my lack of confidence on these sort of stuff...
Anyways, I will follow your suggestions, and questions no more. Unless
of course I have a new problem unsolved...

And Salad, I very much thank you for your advice and pointers. Forgive
me for taking too much of your time and effort.
No problem on time and effort.

Replication is what I would consider an advanced topic. My reasoning:
the majority of Access programmers have never done it. That is one
reason I suggest starting another thread using the word Replication in
the subject line...if that is what you need/want to do in your project.
Those that have done replication may respond. Besides, most look at
new/recent message threads and those after a day or two quickly get ignored.

BTW, in my brief perusings on replication, it appears that autonumber
keys normally are sequential but in replication are random.

A couple of more links.
http://support.microsoft.com/search/...2&mode=a&adv=1
http://support.microsoft.com/kb/190766/en-us

Good luck. May your project be interesting.
>
Jun 17 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1982
by: Paiam Salavati | last post by:
I want to change the the color of the tabs and the color of TabControl itself in a TabControl. Therefore I wrote the following code in my customized TabControl-class: this.DrawMode = TabDrawMode.OwnerDrawFixed; protected override void OnDrawItem(DrawItemEventArgs e) {
2
3100
by: Ty Moffett | last post by:
Below is a set of insructions that changes the registry keys pertaining to Automatic Updates on my Windows XP box. I can make changes using the control panel applet and see the changes reflected via regedit.exe. However when I make the changes with the code below those changed are NOT reflected in the control panel applet even though they are actully being set. Does anyone have any experience with this?
3
15829
by: Martin | last post by:
How does one set up basic authentication on an HttpListener? I know I need to set the HttpListener.AuthenticationSchemes to AuthenticationSchemes.Basic but then I'm unsure how and against what (users on the PC?) the Authentication is occuring. Is there a way for me to receive and control the Authentication attempt myself? This is probably obvious but I've found nothing describing it.
3
1493
by: wolfgang.lipp | last post by:
some time after posting my `Linkdict recipe`__ to aspn__ -- basically, a dictionary with run-time delegational lookup, but this is not important here -- i thought gee that would be fun to make such a customized dictionary thingie an instance dictionary, and get some custom namespace behavior out of that. ... __: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/465748 ... __: http://aspn.activestate.com/
1
6476
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem to be having an effect? ...
7
6181
by: Academic | last post by:
What are the different effects of the following two statements: C1.Cursor = Cursors.WaitCursor C1.Cursor.Current = Cursors.WaitCursor I believe the first replaces the entire C1.Cursor object with a new one while the second only replaces the Current object of C1.Cursor, but I can't
10
2563
by: hummingbirdlj | last post by:
I have a couple questions about setting up automatic client reroute. First, after setting the alternate server for a database, is there a way to verify the settings later on? The next thing is I've added these values for my HADR pair, but I'm not sure I'm testing the basic functionality correctly. I connect to the primary, then issue a switch role takeover, then attempt to continue running SQL against the database (I've also tried a...
2
3328
by: bryars | last post by:
I want to write some SQL which results in an automatic conversion of a datetime to a string in a format suitable for the Language of the connection (either by explicitly setting the Language in the connection string, or by setting the default language in for the user used for the connection.) The casting from string to datetime uses the language setting: Data Source=localhost\sqlexpress;Initial Catalog=master;Persist Security...
3
1766
by: EllieT | last post by:
Hi all, I've been fiddling around with creating a new database (Access 2003, Windows XP) for work the past two weeks and am having trouble defining my own customized (yet still automatic) primary key. I have three different tables that need data inputted (Clients , Complaints , and Queries ) and need individual primary keys for each that are easily identifiable by the first letter and indicative year. I was hoping for something along...
0
1598
by: =?Utf-8?B?QkVB?= | last post by:
Folks, I am developing a deployment project with Visual Studio 2005 that produces an .msi installer. I am not understanding how to create some customized install time actions that I want include, and want to know if there is a better way to achieve some results. The following are the install time tasks I am attempting to perform. 1. I defined a custom action to register and unregister an ActiveX Custom Control (.ocx) after...
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8305
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8730
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 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...
1
8503
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,...
1
6163
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 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...
0
5632
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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
2
1607
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 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...

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.