各类汽车? [英] auto number by category?

查看:66
本文介绍了各类汽车?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能告诉我是否有办法按类别自动编号?


我有2张桌子,费用类别和供应商。


每个费用类别都有许多供应商,但每个类别

为其中列出的每个供应商都有一组特定的数字。即

Expence Catigory是办公用品......所有供应商用于该catigory

列于22401和22499之间。


是有办法让它自动编号,所以办公用品将从

22400开始,并说Office Repair将启动和22500?

解决方案

2006年1月24日12:13:07 -0800,Marina < ma ********* @ earthlink.net>

写道:


号太糟糕了你不要潜伏在这里更常见的,或者您会注意到这是一个常见问题解答。查看此文章:
http://www.mvps .org / access / general / gen0025.htm


要做你想做的事,将字段更改为常规长整数,并且

滚动你自己的编号方案。我喜欢的一种方法是拥有一张桌子

with:

CategoryName,IDToBeUsedNext

OfficeSupplies,22401

OfficeRepair ,22501



然后写一个函数:

GetNextID(byval strCategoryName as string)as Long

这将读取此表中的下一个ID,将值递增1,

并返回读取值。


-Tom。
< blockquote class =post_quotes>有谁可以告诉我是否有办法按类别自动编号?

我有2个表,费用类别和供应商。

每个都有每个费用类别的许多供应商,但每个类别
为其中列出的每个供应商都有一组特定的数字。即
Expence Catigory是办公用品......所有供应商用于该产品
都列在22401和22499之间。

有没有办法让它自动编号,以便办公用品将从
22400开始,说Office Repair会启动和22500?






" Marina" ; <毫安********* @ earthlink.net>写了

有谁能告诉我是否有办法按类别分类?


自动编号只能是唯一的,供

应用程序内部使用,例如查询中的连接。对于任何价值

这个数字有意义的目的,你不应该使用自动编号。


已经或者一直有一些方法可以启动一个特殊值的自动编号,但它们是否有效取决于所涉及的版本

访问 - 并且,因为这意味着该值是有意义的,

不应该使用Autonumbers。


我无法想象试图操纵AutoNumbers以某种方式同步

两个表。在任何一点上,你可能会在系列中找到一个空白,这可能只需要一个数字,或者可能是很多很多数字。


你可以写(或雇用别人为你写)VBA代码,它将遵循你想要的大多数编号方案。另一方面,你可能会有一些

其他设计问题,你应该先将手指

写入密码编写代码。


Larry Linson

Microsoft Access MVP


我有2张桌子,ExpenseCategories和供应商。

每个都有很多供应商到每个费用类别,但每个类别
为其中列出的每个供应商都有一组特定的数字。即
Expence Catigory是办公用品......所有供应商用于该产品
都列在22401和22499之间。

有没有办法让它自动编号,以便办公用品将从
22400开始,说Office Repair会启动和22500?



Marina写道:

每个费用类别都有许多供应商,但每个类别
都为其中列出的每个供应商提供了一组特定的数字。即
Expence Catigory是办公用品......所有供应商用于该商品
列于22401和22499之间。




查看其他回复使用autonumner。我的评论是,上面的

是一种分配供应商编号或识别的愚蠢方法。你真的认为你会有99个可能的供应商吗?如果你的申请仅适用于一个城镇,供应商只需要在b / b
南极... 8)


,也许

您的设计似乎也很愚蠢,似乎如果供应商提供了两个或更多类型的不同费用类别的商品,那么供应商必须列出两个或者更多的时间。


没有特别的数字意味着没有绕过轴的远远更有意义。

执行此操作的系统通常非常差,或者被恐龙标记为卑鄙的b / b $ b的恐龙所支配。一个更好的方法是为某个供应商编号设置一些

序列,这个编号可能只是数字,甚至是由字母数字构建的
。但你真正需要的是第三个

查找表,允许你将单个供应商(列出的ONCE)与

多个类别联系起来。

希望这会有所帮助。当然,我可能有些不对劲,但是从你所描述的很少的情况来看,这是一种灾难性的方法。您可能需要

重新考虑整个操作以及如何将其与数据相关联

实体。


-

Tim http://www.ucs.mun.ca / ~tmarshal /

^ o<

/#)Burp-beep,burp-beep,burp-beep? - Quaker Jake

/ ^^什么是UP,Dittoooooo? - 同上


Can anyone tell me if there is a way to auto number by category?

I have 2 tables, ExpenseCategories and Vendors.

Each there are many vendors to each expense category, but each category
has a specific set of numbers for each vendor listed in it. i.e.
Expence Catigory is Office Supplies... all vendors for that catigory
are listed between 22401 and 22499.

Is there a way to have it auto number so Office supplies would start at
22400 and say Office Repair would start and 22500?

解决方案

On 24 Jan 2006 12:13:07 -0800, "Marina" <ma*********@earthlink.net>
wrote:

No. Too bad you don''t lurk here more often, or you would have noticed
this is a FAQ. Check out this article:
http://www.mvps.org/access/general/gen0025.htm

To do what you want, change the field to a regular long integer, and
roll your own numbering scheme. One approach I like is to have a table
with:
CategoryName, IDToBeUsedNext
OfficeSupplies, 22401
OfficeRepair, 22501
etc.
Then write a function:
GetNextID(byval strCategoryName as string) as Long
that would read the next ID from this table, increment the value by 1,
and return the read value.

-Tom.

Can anyone tell me if there is a way to auto number by category?

I have 2 tables, ExpenseCategories and Vendors.

Each there are many vendors to each expense category, but each category
has a specific set of numbers for each vendor listed in it. i.e.
Expence Catigory is Office Supplies... all vendors for that catigory
are listed between 22401 and 22499.

Is there a way to have it auto number so Office supplies would start at
22400 and say Office Repair would start and 22500?





"Marina" <ma*********@earthlink.net> wrote

Can anyone tell me if there is a way to
auto number by category?
Autonumber is only intended to be unique, for internal use in the
application, such as joins in Queries. For any purpose where the value of
the number is meaningful, you should not use an Autonumber.

There are, or have been, some approaches to starting an Autonumber at a
particular value, but whether they work tends to depend on the version of
Access involved -- and, because that implies that the value is meaningful,
Autonumbers should not have been used.

I can''t imagine trying to manipulate AutoNumbers to somehow synchronize in
two tables. At any point, you may find a gap in the series, and that may be
as little as a single number or may be many, many numbers.

You can write (or hire someone to write for you) VBA code that will follow
most any numbering scheme you want. On the other hand, you may have some
other design problems that you should have reviewed before you put fingers
to keys writing code.

Larry Linson
Microsoft Access MVP

I have 2 tables, ExpenseCategories and Vendors.

Each there are many vendors to each expense category, but each category
has a specific set of numbers for each vendor listed in it. i.e.
Expence Catigory is Office Supplies... all vendors for that catigory
are listed between 22401 and 22499.

Is there a way to have it auto number so Office supplies would start at
22400 and say Office Repair would start and 22500?



Marina wrote:

Each there are many vendors to each expense category, but each category
has a specific set of numbers for each vendor listed in it. i.e.
Expence Catigory is Office Supplies... all vendors for that catigory
are listed between 22401 and 22499.



See the other replies on use of autonumner. My comment is that the
above is a stupid way to assign vendor numbers or identification. Do
you really think you''re going to have just 99 possible vendors? Perhaps
if your application was just for a town and suppliers only located on
the south pole... 8)

Your design also seems stupid in that it seems that if a vendor supplies
you with two or more types of items from different expense categories
then the vendor must be listed two or more times.

It makes far, far more sense to not get wrapped around the axle over
what specific numbers mean. Systems that do this are usually very poor
or are being dictated to by dinosaurs who insist an identifier "mean
something". A far better approach would be to have some sort of
sequence for a vendor number that could be number only or even
constructed from alphanumerics. But what you really need is a third
look up table to allow you to relate a single vendor (listed ONCE) to
multiple categories.

Hope this helps. Of course, I may have got things wrong, but from the
little you''ve described, this is a disasterous approach. You may need
to rethink your whole operation and how you are relating it to data
entities.

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What''s UP, Dittoooooo?" - Ditto


这篇关于各类汽车?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆