创建链接到特定记录的备注表单 [英] Create a notes form linked to a specific record

查看:43
本文介绍了创建链接到特定记录的备注表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我需要一些创建表单/子表单的帮助。场景是我在这个表单上有一个表单我想创建一个按钮来打开页面,可以输入注释和时间戳。在笔记页面上,我希望选择笔记将加上时间戳,并且还希望该页面上的按钮显示添加注释,每次点击时都会添加注释字段,因此可以分隔新注释而不是全部注释一个领域。我已经被困在如何实现这两天,我的搜索没有任何结果。此备注页面应与输入的记录绑定。任何帮助将不胜感激。

Hello I need some assistance with creating a form/subform. The scenarios is I have a form on this form i want to create a button to open a page were notes can be entered and time stamped. On the notes page I would like to have the option that the notes will be timestamped and also would like a button on that page that says add notes which will add the notes field everytime it is click so new notes can be seperated and not all in one field. Ive been stumped on how to achieve this for two days and my searches have come up with nothing. This notes page should be tied to the record that it was entered for. Any help would be appreciated.

推荐答案

概述:


创建一个名为tblNotes的表,其中包含大约4个字段。您将需要一个主键NotesID字段,一个外键CustomerID等字段,以将其与您的客户/记录/订单/随需,注释字段和日期/时间字段相关联。


将此表关联到包含您的客户/记录/订单/无论在数据库关系窗口中的表格。


创建一个选择查询,查找特定记录的注释。


根据此查询创建表单。它应该有三个可见控件和一个不可见控件,对应于您的外键,注释和日期/时间字段以及NotesID字段的不可见控件。在日期/时间字段下的表单上放置一个命令按钮,并在On Click事件中,告诉数据库在Date / Time字段中插入Now()。您可以将命令按钮命名为您喜欢的名称,但它应该是有意义的,名称不应该是Access / VBA保留字之一(如Date,Now等等.cmdDate或cmdNow很好......)标题如你所愿,像时间戳这样的东西会起作用。


现在在主窗体中你需要决定如何调用这个frmNotes表单。可以使用任何事件,但是您可能需要另一个命令按钮,单击该按钮时将使用VBA中的DoCmd.OpenForm命令将您的frmNotes打开到所选记录/客户的所需注释...


问候,

Scott
A general overview:

Create a table called tblNotes with about 4 fields. You will need a primary key NotesID field, a foreign key CustomerID etc field to relate this to your Customer/Record/Order/Whatever, a notes field and a date/time field.

Relate this table to the table containing your Customer/Record/Order/Whatever in the database relationships window.

Create a select query that looks up the notes for a certain record.

Create a form based on this query. It should have three visible controls and one invisible, corresponding to your foreign key, notes, and date/time fields and the invisible control to your NotesID field. Place a command button on the form under the Date/Time field, and in the On Click event, tell the database to insert Now() in the Date/Time field. You can name the command button what you like, but it should be meaningful and the name shouldn''t be one of the Access/VBA reserved words (like Date, Now, etc. cmdDate or cmdNow are fine...) Caption it as you wish, something like Time Stamp would work.

Now in the main form you will need to decide how you want to call this frmNotes form. Any of the events can be used, but likely you''ll want another command button that when clicked will use the DoCmd.OpenForm command in VBA to open your frmNotes to the desired note for the selected record/customer...

Regards,
Scott



概述:


创建一个名为tblNotes的表,其中包含大约4个字段。您将需要一个主键NotesID字段,一个外键CustomerID等字段,以将其与您的客户/记录/订单/随需,注释字段和日期/时间字段相关联。


将此表关联到包含您的客户/记录/订单/无论在数据库关系窗口中的表格。


创建一个选择查询,查找特定记录的注释。


根据此查询创建表单。它应该有三个可见控件和一个不可见控件,对应于您的外键,注释和日期/时间字段以及NotesID字段的不可见控件。在日期/时间字段下的表单上放置一个命令按钮,并在On Click事件中,告诉数据库在Date / Time字段中插入Now()。您可以将命令按钮命名为您喜欢的名称,但它应该是有意义的,名称不应该是Access / VBA保留字之一(如Date,Now等等.cmdDate或cmdNow很好......)标题如你所愿,像时间戳这样的东西会起作用。


现在在主窗体中你需要决定如何调用这个frmNotes表单。可以使用任何事件,但是您可能需要另一个命令按钮,单击该按钮时将使用VBA中的DoCmd.OpenForm命令将您的frmNotes打开到所选记录/客户的所需注释...


问候,

Scott
A general overview:

Create a table called tblNotes with about 4 fields. You will need a primary key NotesID field, a foreign key CustomerID etc field to relate this to your Customer/Record/Order/Whatever, a notes field and a date/time field.

Relate this table to the table containing your Customer/Record/Order/Whatever in the database relationships window.

Create a select query that looks up the notes for a certain record.

Create a form based on this query. It should have three visible controls and one invisible, corresponding to your foreign key, notes, and date/time fields and the invisible control to your NotesID field. Place a command button on the form under the Date/Time field, and in the On Click event, tell the database to insert Now() in the Date/Time field. You can name the command button what you like, but it should be meaningful and the name shouldn''t be one of the Access/VBA reserved words (like Date, Now, etc. cmdDate or cmdNow are fine...) Caption it as you wish, something like Time Stamp would work.

Now in the main form you will need to decide how you want to call this frmNotes form. Any of the events can be used, but likely you''ll want another command button that when clicked will use the DoCmd.OpenForm command in VBA to open your frmNotes to the desired note for the selected record/customer...

Regards,
Scott



我试过这种方法并且有些不成功。当我试图保存笔记时,我得到错误您无法添加或更改记录,因为表格tblcustomerinformation中需要相关记录。我该如何解决这个问题。

I attempted this method and have been somewhat unsuccessful. When I attempt to save the notes I get the error " You cannot add or change a record because a related record is required in table "tblcustomerinformation" How can I resolve this.



我尝试了这种方法并且有些不成功。当我试图保存笔记时,我得到错误您无法添加或更改记录,因为表格tblcustomerinformation中需要相关记录。我该如何解决这个问题。
I attempted this method and have been somewhat unsuccessful. When I attempt to save the notes I get the error " You cannot add or change a record because a related record is required in table "tblcustomerinformation" How can I resolve this.



为了澄清这个问题,你在tblcustomerinformation和tblnotes之间有一对多的关系。您需要构造表,以便链接字段(customerID)在tblnotes中而不在tblcustomerinformation中。


如果您填写表单中填写了您输入备注的内容是正确构建的,那么您将不会遇到此错误,因为它不会尝试创建一个备注记录没有客户。


您可以发布表元数据以及用于填充注释表单的查询的SQL吗?以下是如何发布表元数据的示例:

表名= tblStudent


1.字段;类型; IndexInfo

2. StudentID;自动编号; PK

3.家庭;串; FK

4.姓名;字符串

5.大学;串; FK

6.马克;数字

7. LastAttendance;日期/时间


谢谢,

问候,

Scott


To clarify the issue, you have a one to many relationship between tblcustomerinformation and tblnotes. You need to structure the tables so that the linking field (customerID) is in the tblnotes and not in tblcustomerinformation.

If your query to populate your form that you enter notes into is built correctly, then you will not encounter this error as it will not be attempting to create a note record for which there is no customer.

Could you post your table meta data as well as the sql of your query that you are using to populate the notes form? Here is an example of how to post table MetaData :
Table Name=tblStudent

1. Field; Type; IndexInfo
2. StudentID; AutoNumber; PK
3. Family; String; FK
4. Name; String
5. University; String; FK
6. Mark; Numeric
7. LastAttendance; Date/Time

Thanks,
Regards,
Scott


这篇关于创建链接到特定记录的备注表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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