473,395 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

autonumbering of a field with several categories

hi guys, im new in microsoft access and i got stuck with some problems.
i created a table called inventory transaction and the fields are 'transaction No (PK)' "transaction reason', 'transaction date','items', etc.
Here's my areas of concern.
1. transaction code consist of several categories such as 'production' and 'purchases', if i select "production" as my transaction reason, transaction No will start with 1. and if i select "purchases", transaction no. should also starts with 1. in short Transaction No sequence should be separate for the 2 categories

tnx a lot
May 28 '09 #1
3 1347
NeoPa
32,556 Expert Mod 16PB
In these circumstances it is not AutoNumbering you need. It's explicit, controlled setting of the number instead.

We can help with this but could you first explain where Transaction Code fits in? You gave a list of fields, then proceeded to explain your problem with reference to a field you hadn't included. This muddies the waters rather and I don't want to proceed with a fuzzy understanding of your problem as that way leads to problems and confusions.

This will work much better if you can post the meta-data (info about the layout / structure) of the table in the same way as I use in my example. Click on the Reply button and you will have access to all the codes I've used. PK & FK stand for Primary Key & Foreign Key respectively. Please don't use any TABs in your formatted layout as this will not display correctly - Spaces only for layout.
Table Name=[tblStudent]
Expand|Select|Wrap|Line Numbers
  1. Field           Type        IndexInfo
  2. StudentID       AutoNumber  PK
  3. Family          String      FK
  4. SName           String
  5. University      String      FK
  6. Mark            Numeric
  7. LastAttendance  Date/Time
May 28 '09 #2
tnx neo, these are some info abt my proj.
Table=[Inventory Transaction]
Expand|Select|Wrap|Line Numbers
  1. Field               Type
  2. Transaction Code    autonumber  PK
  3. Transaction Reason  text
  4. Transaction Date    date
  5. Item Code           text
  6. Transaction Qty     number
I have 2 transaction reasons which are "production" and "puchases". i want each of them to have separate transaction code numbering/sort

tnx
May 30 '09 #3
NeoPa
32,556 Expert Mod 16PB
So. [Transaction No] doesn't exist at all. Please be more careful in future.

As for your question, the [Transaction Code] field needs to be changed to a Number / Long Integer field and something else added into your PK. A PK MUST be unique. You would probably want to add the [Transaction Reason] into the PK such as :
Expand|Select|Wrap|Line Numbers
  1. Field               Type
  2. Transaction Reason  Text    PK (Composite)
  3. Transaction Code    Number  PK (Composite)
  4. Transaction Date    Date
  5. Item Code           Text
  6. Transaction Qty     Number
The new setting for each record would be determined in the code of your form as (assuming TextBox controls of txtTranCode & txtTranCode) :
Expand|Select|Wrap|Line Numbers
  1. txtTranCode=Nz(DMax("[Transaction Code]", _
  2.                     "[Inventory Transaction]", _
  3.                     "[Transaction Reason]=' & txtTranReason & "'")
I hope this clarifies things a bit for you.
May 30 '09 #4

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

Similar topics

2
by: netx | last post by:
I created table with "id" field as "uniqueidentifier" (primary key). I connect via ODBC from MS-Acces. -->>> Don't know how to something like "Autonumber" in MS-Access. Let me know If any...
2
by: Richard | last post by:
Hi, Could anyone help me with the following problem? I created a database for scientific documents, using the usual AutoNumbering for creating Document_ID's (primary key). The Document_ID's...
2
by: N. Graves | last post by:
Hey is there a command like in SQL Transactional that will reset the Autonumber field to the highest number in the found in the field? I developing a access database with a several table that...
1
by: LurfysMa | last post by:
I am working on an electronic flashcard program. Most of the subjects are simple lists of questions and answers. Those seem to be working. Some of the "subjects" have "categories" of questions. ...
1
by: Chris | last post by:
I am trying to assign an ID number from one table into another table through forms. Is it possible to create a command button on a form to feed a new record with this existing number? For...
1
by: phpnewbie112 | last post by:
Hi everyone, I am new to php and I was trying hard to alter an existing script ut I didn't succeed to... I have 2 databases: - Categories (catid, shortname, description) - Transactions (date,...
3
by: mckbill | last post by:
Is there a way I can direct the cursor to a specific field (variable) in a form by typing the field name while in form view? I have a form with many fields, and it would be nice if there were...
1
by: FRENCH GUY | last post by:
Hi everyone, At the moment, I am working on a database with several tables. Almost every table has her own autonumbering field. So herefore, I am looking for the command that I have to include in...
2
BeemerBiker
by: BeemerBiker | last post by:
I have a combo box field "Grouping" in "MyTable" and set the design to Row Source: SELECT Categories.Grouping, Categories.index FROM Categories; BoundColumn: 1 Column Count: 2 Column...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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...
0
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...

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.