制定指数值 [英] Formulate Index Value
问题描述
我为我的CD收藏开发了一个数据库。我正在尝试开发每张CD的序列号,这些序列号将根据以frmCDDetails形式输入的数据填充。此表单基于一个名为tblCDDetails的表,该表组合了各种表的数据。
表1 tblMusicCategory
字段1:MusicCategoryID - 自动编号(主要)
字段2:MusicCategory - 文本
字段3:MusicCategoryAbbv - 文本
每个类别都是唯一的2个字母的缩写。示例,轻松聆听= EL,爵士= JZ,古典= CL,国家= CO
表2 tblArtists
字段1 ArtistID - 自动编号(主要)
Field 2 ArtistName - text
Field 3 ArtistAbbv - text
每个艺术家都有一个3个字母的缩写来标识它们。例如,John Denver是JDA,Julio Iglesias是JIB,Fran Sinatra FSC等。
我希望序列号读作XX.YYY.00.000.0000
XX =该类别的2封信
YYY =艺术家的3封信
00 =该艺术家的CD运行数
000 =该类别的运行编号
0000 =整个集合的运行编号。
示例:CO.JDA.10.030.0275
我
这意味着这张CD是John Denver的第10张CD。国家类别中有30张CD,总CD收集是275
这是我的目标。
到目前为止,我成功地使用表格frmCDDetails上的文本框中的选择功能创建了2个字母的类别部分。
剩下的我正在努力。例如,我无法显示艺术家缩写(而是显示艺术家ID号)。也许是因为ArtistID不是tblCDDetails的一部分,而是一个名为tblArtists的表,它用于子表单并添加到frmCDDetails。
有人可以帮助我吗?
请记住我是新手并且对VBA或具体功能知之甚少,除非用一个例子来解释。
非常感谢那里的所有大师。我希望你们中的一个可以提供帮助。
I have developed a database for my CD collections. I am trying to develop serial number of each CD which will populate based on data entered in a form called frmCDDetails. This form is based on a table called tblCDDetails which combines data from various tables.
Table 1 tblMusicCategory
Field 1: MusicCategoryID - Auto Number (Primary)
Field 2: MusicCategory - text
Field 3: MusicCategoryAbbv - text
Each category is uniquely given 2-letter abbreviation. Examples, Easy Listening = EL, Jazz = JZ, Classical = CL, Country = CO
Table 2 tblArtists
Field 1 ArtistID - Auto Number (Primary)
Field 2 ArtistName - text
Field 3 ArtistAbbv - text
Each artist is given a 3-letter abbreviation to identify them. for example, John Denver is JDA, Julio Iglesias is JIB, Fran Sinatra FSC etc.
I want the serial number to read as XX.YYY.00.000.0000
XX = 2 letter from the category
YYY = 3 letter from the artist
00 = running number of CD for that artist
000 = running number for that category
0000 = running number for the entire collection.
Example: CO.JDA.10.030.0275
I
This means this CD is the 10th CD by John Denver. There are 30 CDs in Country Category and the Total CD collection is 275
I am trying to get this Serial number to be automatically populated when I select 1)MusicCategoryID and 2)ArtistID. In other words, as I select Country in the Category the text box for the Serial number will popualate as CO. and as I enter John Denver''s name, the Serail number will populate as CO.JDA.10.030.0275
This is my goal.
So far I succeeded in creating the 2-letter Category part by using Choose function in a text box on the form frmCDDetails.
The rest I am struggling. For example, I couldn''t get the Artist Abbreviation to display (instead the Artist ID number is displayed). Perhaps because ArtistID is not a part of the tblCDDetails but of a different table called tblArtists which is used for a subform and added to the frmCDDetails.
Can someone please help me with this?
Please remember I am a Novice and don''t have much knowledge of VBA or specific functions unless it''s explained with an example.
Many thanks to all the gurus out there. I am hoping one of you can help.
推荐答案
您必须进行严格的编码才能进行自定义文本自动增量字段。然后你必须使用DMax函数来自动填充它。
我不完全理解你的概念,但这里是我的理解。
假设你有2个组合框:
1 cboMusicCategoryID
2 cboArtistID
和1个自动递增序列号的文本框。
1 txtSerialNo >
在cboMusicCategoryID字段上执行After Update事件:
You would have to do rigorous coding to do your customized text Auto Increment field. Then you would have to use the DMax function to auto populate it.
I dont'' fully understand your concept but here''s how i understand it.
Let''s say you have 2 combo boxes:
1 cboMusicCategoryID
2 cboArtistID
and 1 textbox for your Auto Increment Serial Number.
1 txtSerialNo
Do an After Update event on your cboMusicCategoryID field:
非常感谢你帮我解决问题。
正如你所说,这将是非常严谨的,但我一定会试一试。我决不会彻底了解VBA,但我会努力。由于我对VBA的了解有限,我可以告诉你向我展示了编码的正确方法。让我们看看。
请你发布。
非常感谢。
Thank you so much for taking the trouble in helping me.
As you said, it''s going to be rigoruous but I will definitely give it a try. By no means I understand VBA thoroughly but I will make an effort. With my limited knowledge of VBA I can tell you showed me the correct way to coding. Let''s see.
Shall keep you posted.
Many thanks.
没问题。我希望你能找到答案。
我就像你一样开始,通过使用MS Access帮助进行自学,我学到了现在所知的大部分内容,以及课程, www.bytes.com
欢迎来到论坛。
No problem. I hope you find the answer.
I started like you are and I learned most of what I know now through self study using the MS Access Help, and OF COURSE, www.bytes.com
Welcome to the forum.
这篇关于制定指数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!