可供选择的类别的易变列表 [英] Volatile List of Categories to Choose From

查看:69
本文介绍了可供选择的类别的易变列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一种感觉,要么这样做要么太复杂,要么就这么简单易行,我只是错过了它。因此,您将提供的任何帮助将不胜感激!这就是我所拥有的:


我正在创建一个数据库来帮助管理在给定工作站上使用的工具。我有几十个工作站,每个工作站都有不同的配置(例如机械装配,电气装配和产品支持)。每个工作站根据其配置需要不同的
工具。例如,机械装配工作站需要扭矩扳手等工具,而电气装配工作站则需要烙铁。


我为每个工作站设置了一个表,其中包含了ID号,员工在该工作站工作的人员的ID,他们设置的工作站类型以及工作站的位置。我设置了另一个表来列出每种类型工作站所需的每个工具
(两个字段:"jctTypes"表示工作站类型,"jctToolTypes"表示所需工具的一般描述,即" "Soldering Iron","Torque Wrench","Digital Multi-Meter",
等。我有第三个表格,其中包含一系列工具,这些工具包含许多不同的字段,包括工具ID,制造商,型号,工具类型(前面提到的"jctToolTypes"中使用的相同通用描述),以及一些测量值到
有助于确定ESD分类。最后,我将第四个表设置为联结表(三个字段:工作站ID的"jctBenchID",工具ID号的"jctToolID"和"txtToolStatus",表示
工具已经订购,安装或出来进行校准。)


我的问题是:我如何创建一个可以帮助结合所有这些信息的表格?我希望能够从组合框中选择一个工作站ID号,让它列出该工作站所需的所有通用工具描述,基于
工作站类型,并允许我从每个类别中选择一个工具(即,"扭矩扳手"类别的所有可用扭矩扳手的列表或来自"数字多用表"类别的所有可用DMM的列表)。


I我非常精通VBA,所以我不会回避某些代码,如果有更有效的方法来组织我的数据,我会非常开放,假设它可以帮助我完成这项任务。


谢谢!

解决方案

从您的描述中我不认为四个表格对于模型来说已经足够了,我认为这个表格就像这个:
$






顶部和底部的表格模拟主要实体类型,而两个中心表模拟它们之间的多对多关系类型。



对于数据输入,您可以有一个工作站表单,其中有一个WorkstationTools子表单。 子窗体将包含一个未绑定的组合框,用于列出与父
表单中当前所选工作站的工作站类型相关的工具类型,方法是将父窗体中的相应控件引用为其RowSource属性中的参数。 与此组合框相关联的是另一个组合框,其中列出了在未绑定的组合框中选择的工具类型的工具。 这个
将绑定到外键工具列或类似的。



如果使用连续表单视图子表单,正如我所料,有一个使用'自然'键作为Tools表的主键及其在WorkstationTools中对应的外键的强有力的案例 表群组。否则你需要使用
叠加在 上的文本框的"混合"控件。如果使用数字'代理'键,则为组合框。 对于连续表单视图子表单,未绑定工具类型组合框当然应该在其标题中,除了在其AfterUpdate事件过程中重新查询
绑定工具组合框之外,还需要代码子窗体的当前事件过程,根据当前选定的工具将正确的值分配给未绑定的组合框,因为记录指针从子窗体中的
行移动到行。



父表单中的未绑定导航组合框可让您选择并移动到工作站记录。 或者,您可以使用未绑定的表单作为父表单,并引用父表单中的未绑定的组合框作为子表单控件的
LinkMasterFields属性。

I have a feeling this is either going to be too complicated to do or it's so ridiculously simple to do that I'm just missing it. So any help you can offer would be greatly appreciated! Here's what I've got:

I'm creating a database to help manage tools used at a given workstation. I've got a few dozen workstations, each with different configurations (for example mechanical assembly, electrical assembly, and product support). Each workstation would require different tools based on its configuration. For example, a mechanical assembly workstation would require tools like torque wrenches while an electrical assembly workstation would require soldering irons.

I have a table set up for each workstation with it's ID number, the employee ID of the person working at that station, they type of workstation it's set up to be, and the location of the workstation. I have another table set up to list each tool required at each type of workstation (two fields: "jctTypes" for the type of workstation and "jctToolTypes" for a generic description of the tool required, i.e. "Soldering Iron", "Torque Wrench", "Digital Multi-Meter", etc.). I have a third table set up with a list of tools available with a number of different fields including Tool ID, Manufacturer, Model, Tool Type (the same generic description used in "jctToolTypes" mentioned before), and a few measurements to help determine ESD classification. Finally, I have a fourth table set up to be a junction table (three fields: "jctBenchID" for the workstation ID, "jctToolID" for the tool ID number, and "txtToolStatus" indicating whether the tool has been ordered, installed, or is out for calibration).

My question is this: How would I create a form that could help combine all of this information? I'd like to be able to choose a workstation ID number from a combobox, have it list all of the generic tool descriptions required for that workstation based on the workstation type, and allow me to choose a tool from each category (that is, a list of all available torque wrenches for the "Torque Wrench" category or a list of all available DMMs from the "Digital Multi-Meter" category).

I'm pretty proficient in VBA, so I won't shy away from some code and I'm very open if there's a more efficient way to organize my data assuming it will help me accomplish this task.

Thanks!

解决方案

From your description I don't think four tables is sufficient for the model, which I'd envisage to be like this:



The tables at the top and bottom model the main entity types, while the two central tables model the many-to-many relationship types between them.

For data entry you could have a Workstations form, within which is a WorkstationTools subform.  The subform would contain an unbound combo box to list the tool types which relate to the workstation type of the workstation currently selected in the parent form by referencing the appropriate control in the parent form as parameter in its RowSource property.  Correlated with this combo box would be a further combo box which would list the tools of the tool type selected in the unbound combo box.  This would be bound to the foreign key Tool column or similar.

If a continuous forms view subform is used, as I would expect, there is a strong case for using 'natural' keys for the primary key of the Tools table and its corresponding foreign key in the WorkstationTools  table.  Otherwise you would need to use a 'hybrid' control of a text box superimposed on a  combo box if numeric 'surrogate' keys were used.  In the case of a continuous forms view subform, the unbound tool types combo box should be in its header of course, and in addition to requerying the bound tool combo box in its AfterUpdate event procedure, code would be needed in the subform's Current event procedure to assign the correct value to the unbound combo box on the basis of the currently selected tool as the record pointer is moved from row to row in the subform.

An unbound navigational combo box in the parent form would enable you to select and move to a workstation record.  Alternatively you could use an unbound form as the parent form, and reference the unbound combo box in the parent form as the subform control's LinkMasterFields property.


这篇关于可供选择的类别的易变列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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