需要帮助根据表单条件自动填充子表单中的行 [英] Need help autopopulating rows in subform based on form criteria

查看:67
本文介绍了需要帮助根据表单条件自动填充子表单中的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好 -


我正在使用2002并认为自己是一个中间访问用户,但是新手程序员:)我从地狱的任务是db项目上周一直在寻找相关的片段。问题是我的问题是多层次的,虽然我已经看到提示我还没有遇到过这样的问题。所以 - 这里没有进一步的麻烦。


我有一个有3张桌子的数据库。客户,SWO和CableRecords。本质上,数据库的目的是记录电缆的序列号,以确保不会发生未经授权的复制。对我来说不幸的是,在某些情况下它是允许的,所以我不能设置一个硬性和快速的规则,不允许它们,只需要让用户知道它存在并让他们根据数据做出决定。


我正在努力解决的问题是......我需要某种类型的数据输入表单,允许用户选择客户,程序集(均来自客户表)和SWO(来自SWO表)并输入要构建的电缆数。然后我需要它来提示附加信息,如果它不是现有的程序集(可能是弹出窗体?),然后根据输入的#of数据中输入的数字,从下一个可用数字开始逐步自动填充电缆记录表建造


此时我觉得自己像个僵尸 - 我一直在阅读任何我能做的事情,并且已经看到了使用追加或插入的不同引用。我真的需要一些帮助,因为我肯定在我脑海里,没有其他人能够帮助我。我附上了db的精简版。我很高兴提供有关领域等的其他信息,但想知道是否有人在那里做了类似的事情。我通常会说,我确定有,但在上周之后,我只是输了:)


感谢大家的帮助!

Angie



附加文件
(92.0 KB,71 views)


好的安吉,今晚下班回家的时候,我会试着去看看。

我在英国。你在哪个时区,以便我知道什么时候我不应该有任何回应?


Hi All -

I''m using 2002 and consider myself an intermediate Access user but newbie programmer :) I''ve been tasked with the db project from hell and have been combing through posts for the last week looking for relevant snippets. The problem is that my problem is multi-tiered and although I''ve seen hints I haven''t yet come across anything like this problem. So - without further ado here''s the situation.

I''ve got a db that has 3 tables. Customer, SWO, and CableRecords. Essentially the purpose of the database is to log serial numbers for cables to ensure unauthorized duplication doesn''t occur. Unfortunately for me there are some cases where it''s allowed so I can''t set a hard and fast rule to not allow them, just have to make the user aware that it exists and let them make the determination based on the data.

The part that I''m struggling with is this.... I need a data entry form of some type that would allow the user to select the customer, assembly (both from the customer table) and SWO (from the SWO table) and enter "# of cables to be built". I then need it to prompt for additional information if it''s not an existing assembly (perhaps popup form?) and then autopopulate the cable records table incrementally starting at the next available number based on the number entered in "# of cables to be built".

At this point I feel like a zombie - I''ve been reading anything and everything I can and have seen different references to either using append or insert. I really need some help on this one as I''m definitely in over my head and there''s nobody else able to help me here. I have attached a stripped down version of the db. I''m happy to provide additional info on fields, etc but wanted to see if there''s anyone out there that''s done something similar. I would normally say that I''m sure there is but after the last week I''m just lost :)

Thanks everyone for your help!
Angie

Attached Files
WIPACDB.zip (60.3 KB, 80 views)

解决方案

I guess you didn''t get very far with the class idea yet Angie.

I may be able to help here (I hope so).
Can you explain in real-world terms what your database is for. I was unable to guess what a cable is or an SWO (some sort of Work Order perhaps).
The attached database saves asking a whole heap of questions, but I''d like a better handle on what you''re attempting here.


Lol - a cable is literally that - my company produces electrical cables that are used in cool stuff like rockets and tanks :)

Because of that, the Assembly alone isn''t unique - it''s the Customer/Assembly combination that makes it unique hence the CableID field in tblCustomer is used as the key.
Essentially any action in the database will start with a form that allows the user to select the Customer from a combo box and enter the Assembly into a text box. When they click the command button it searchs via loading a form (frmCableView) that populates based off a pquery and shows the related SWOs (Sales Work Orders) in a list box and has a subform that displays each individual cable ordered by S/N (serial number).

This part all works beautifully and life is good.

The problem is that I need a way for the user to be able to add X number of records automatically based off the Customer & Assembly (from the tblCustomer) and SWO (from tblSWO).

I would like the user to be able to click the SWO from the listbox on the frmCableView and click an ''Add Record'' button to pop open a form where she could enter the number of records she''d like to create [Qty Issued] and enter the information that would repeat in each field of tblCableRecords ([Date], [KIT], [RMA], [DWG Rev], [PWO Rev], [AC Rev], [Issued To], [Issued By], [MOrder], [Comments], [Adjustments]). C/N (cable number) is a number that increases incrementally for each SWO and S/N is incremental for each Customer/Assembly. So, when said user enters the pertinent info and hits the ''Create Records'' button then it would autopopulate all 3 tables based off the information contained on that form. Additionally it needs to calculate the C/N and S/N and populate them.

I have done lots and lots of reading and I know I need to use the DMAX function for the incremental records. I think I need to use a Do/While loop for the count and I''m fairly certain this has to do with the AddNew using a recordset (or maybe insert record?). But how those things go together is beyond me at this point my brain feels like a pretzel.

To assist I''m going to attempt to attach a new copy of the db as I''ve made some changes and the forms I referenced above aren''t the same as my intial entry.

Attached Files
WIPACDB.zip (92.0 KB, 71 views)


OK Angie, I''ll try to loook at this when I get home from work this evening.
I''m based in England. What time-zone are you in so that I know when I SHOULDn''t expect any responses?


这篇关于需要帮助根据表单条件自动填充子表单中的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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