是否可以创建未绑定的子表单? [英] Is it possible to create unbound subforms?

查看:69
本文介绍了是否可以创建未绑定的子表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个客户输入数据表单,其中包含有关公司名称,地址等的基本信息。我已为此类数据输入创建了未绑定的测试框,并使用SQL插件将其上载到Cust_Basic_Info表。

现在我想添加两个具有多个输入的子表单。一个是客户联系人。这些可以是2或4或更多。同样,另一种形式是客户部分。我为不同的客户提供不同的产品价格。因此,我需要为每位客户提供单独的零件清单。第一列将是部分,其将来自部分部分。表。第二栏是价格。第三列是客户自己的部件号。

我可以为这两个输入使用电子表格或多个输入子表单。主要问题是,他们受到约束,他们会立即更新表格。作为我的主要表单,它是具有customer_name字段的基本信息,充当其他两个表的外键。由于该表单具有未绑定的控件,我无法为子表单创建绑定控件,除非我首先上传此表单。

我希望一次性提交新客户的所有数据,使用我自己的VBA代码和一个按钮。我不想一次添加一个部分或一个联系人。

任何人都可以帮我解决怎么办?

I have a customer entry data form, which has basic info about company name, address etc. I have created unbound test boxes for such data entry and uploading them to the Cust_Basic_Info table using SQL insert.
Now I want to add two subforms, those having multiple inputs. One is for customer contact persons. These may be 2 or 4 or more. Similarly another form is for customer parts. I have different prices for my product for different customers. So I need to have a separate part list for every customer. First column would be of parts, which will come from "Parts" table. Second column is price. Third column is customer''s own part-number.
I can use spread sheet or multiple entry subform for these two inputs. Main issue is, as they are bound, they immediately update the table. As my main form, which is basic info, which has customer_name field, that acts as a foreign key to other two tables. As that form has unbound controls, I can not create bound control for subforms, unless I first upload this form.
I want all the data of new customer to be submitted at one go, with my own VBA code and with one button. I dont want to keep adding one part or one contact at one time.
Can any one help me on how to proceed?

推荐答案

Ashishk76,


It 有点难以完全按照你要做的做法,但如果你只是想要一个未绑定的子表单,只需删除子表单的父/子属性即可。然后你就可以让子表单做你想做的任何事情了。


如果你准确地告诉我们你尝试了什么,并给出你的数据库正在做什么以及你做什么的确切示例希望它以不同的方式做,我们会尽力帮助。


谢谢!
Ashishk76,

It''s a little difficult to follow exactly what you are trying to do, but if you simply want an unbound subform, just delete the Parent/Child properties of the subform. Then you can have the subform do whatever you want it to do.

If you show us exactly what you''ve tried and give exact examples of what your DB is doing and what you want it to do differently, we will try to help.

Thanks!


twinnyfo,感谢您的回复。以下是我的工作:


1.表Cust_Basic_Info

字段:ID(主键),Cust_Name,Cust_Address等

2.表Cust_Contacts

字段:Cust_Name(表Cust_Basic_Info中的外键)

Contact_Name,Contact_Email,Contact_Mobile等

3.表Cust_Parts

字段:Cust_Name(表Cust_Basic_Info中的外键)

Part_No。 (来自表格部分,即表4)

Cust_Part_No,价格等。

4.表格部分:

归档:Part_no ,Part_Dimension等


创建这些表后,我创建了一个表单New_Customer_Entry,我将在其中输入新客户。

我没有直接创建基于表Cust_Basic_Info的条目表单,而是使用了未绑定的文本框用于所有输入字段,而我使用的是提交字段。使用SQL INSERT INTO语句将此信息提交到表的按钮。


现在有趣的部分:

1.我在New_Customer_Entry表单上创建了3个标签

2.主表单标题有一个文本框,我将在其中输入新的

客户名称和页脚有两个按钮:保存,取消

3.此客户名称文本框并且两个按钮对于所有三个选项卡是通用的。


4.在标签1上,我有cust_basic_info,它有所有未绑定的文本框。

5.在标签2上,我想创建一个像结构一样的电子表格,用户将输入该公司的所有联系人。

问题1:Cust_Name(这是Cust_Contacts表的外键,这些值将在哪里,尚未更新为未绑定字段。所以我希望选项卡2上的所有文本框也不绑定。但是我需要手动创建许多文本框并正确排列它们,这非常耗时。


问题2:在我到达标签2之前我以某种方式更新了cust_name并使用了对于cust_contacts条目绑定数据表子表单。将数据输入到1字段并点击选项卡转到下一个字段,数据自动填充到表格中。没有保存或取消按钮。如果输入的数据不正确,我必须使用太多的VBA代码来取消输入。


我希望所有数据都填入未绑定的文本框,然后点击页脚的保存按钮将所有数据保存到所有数据上面提到的不同的表。如果出于任何原因有人想要取消,他可以点击取消按钮并且没有填充表格。


问题3:如果我创建像表单一样使用未绑定的电子表格并将其用作子表单,是否可能?如你所说,我可以创建一个speadsheet类型表单,然后删除记录源。但在这种情况下,它用#Name?之类的东西锁定所有输入字段。


我希望我已经清楚了解这些问题。提前感谢您阅读这条长信息。
twinnyfo, thanks for your reply. Here is what I have done:

1. Table Cust_Basic_Info
Fields: ID (Primary key), Cust_Name, Cust_Address etc.
2. Table Cust_Contacts
Fields: Cust_Name (Foreign Key from Table Cust_Basic_Info)
Contact_Name, Contact_Email, Contact_Mobile etc.
3. Table Cust_Parts
Fields: Cust_Name (Foreign Key from Table Cust_Basic_Info)
Part_No. (from Table "Parts", which is table 4)
Cust_Part_No, Price etc.
4. Table Parts:
Fileds: Part_no, Part_Dimension etc.

After creating these tables, I have created a form "New_Customer_Entry", where I will be entering new customer.
Rather than directly creating a entry form based on table Cust_Basic_Info, I have used unbound text boxes for all the entry fields and I am using a "Submit" Button to submit this info to the table, using SQL INSERT INTO statement.

Now the interesting part:
1. I have created 3 tabs on New_Customer_Entry form
2. Main Form Header has a text box, where I will enter the new
Customer name and the footer has two buttons: "Save", "Cancel"
3. This customer name text box and two buttons are common to all three tabs.

4. On tab 1, I have cust_basic_info and it has all unbound text boxes.
5. On tab 2, I want to create a spread sheet like structure, where user will enter all the contacts for the company.
ISSUE 1: Cust_Name (which is a foreign key for Cust_Contacts table, where these values will go, is not yet updated being a unbound field. So I want all the text boxes on tab 2 also unbound. But then I need to create many text boxes manually and arrange them properly, which is very time consuming.

ISSUE 2: I somehow update the cust_name before I get to tab 2 and use a bound datasheet subform for cust_contacts entry. The moment data is entered in to 1 field and hit tab to go to next field, data is automatically populated in tables. There is no save or cancel button. If incorrect data entry is done, I have to use too many lines of VBA code to cancel the entry.

I want all data to be filled in unbound text boxes and then hit save button at the footer to save all the data to all different tables mentioned above. If for any reason some one wants to cancel, he can hit Cancel button and no table is populated.

Issue 3: If I create unbound Spreadsheet like form and use it as subform, is it possible? As you said, I can create a speadsheet type form and then delete the Record Source. But in that case, its locking all the entry fields with something like #Name?.

I hope I have made myself clear with the issues. Thanks in advance for reading this long message.



我希望所有数据都填入未绑定的文本框,然后点击保存按钮页脚将所有数据保存到上面提到的所有不同表中。
I want all data to be filled in unbound text boxes and then hit save button at the footer to save all the data to all different tables mentioned above.



这是一种非常非传统的方法,我或其他许多专家绝不推荐的方法。我可以远程看到这种情况的唯一方法是使用多个记录集在单个或嵌套事务中执行保存操作。基本上 ALL 数据保存到每个表或数据全部保存。您不能冒险将保存操作执行到一个或多个表而不是其他/其他表。

This is a very unorthodox approach, one which I, or I would guess many other Experts would never recommend. The only way I can remotely see this happening is with Multiple Recordsets performing the Save Operations within a Single or Nested Transactions. Basically ALL the Data is saved to every Table or NO Data is saved at all. You cannot run the risk of performing Save Operation to one or more Tables but not another/others.


这篇关于是否可以创建未绑定的子表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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