访问表单问题 [英] Access form problem

查看:59
本文介绍了访问表单问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。我在MS Access中比较新。我想制作一个输入/编辑表格,输入一个人在某一天起飞的小时数。在表单中我有一个人物搜索按钮,我可以从tblPerson表中选择一个人,以及一个日历来获取特定日期。我想要更新的表是tblHoursOff,它包含PersonID,DateOff(两者都是主键的一部分),HoursOff,Reason,Comment字段。


我的问题是如何使用人物搜索中的PersonID和我从日历中获取的日期来显示tblHoursOff中的记录(如果存在)或输入新记录(如果不存在)在它中。

解决方案

最简单的方法是创建一个按钮。让我们称它为cmdAddPerson。


然后你需要以下代码:

展开 | 选择 | 换行 | 行号


谢谢,mmccarthy。我会尝试一下,让你知道结果。再次感谢。


您好mmccarthy。谢谢agian。我把你的陈述放进去了。它有效,但它弹出一个窗口,要求约会。对不起,我没有说清楚。也许,我应该提供更详细的规格。我有这些表和表格:


表。

tblPeople包含以下字段PeopleID - autonum主键,CheckinID,LastName,FirstName,Super,Type。


tblOffDetail with ChekinID,DateOff(这两个构成主键),OffHours,OffType,Comments。


表格:

frmPeople使用tblPeople字段和命令按钮cmdPersonSearch在单击时打开另一个frmSearchPeople表单。


frmSearchPeople。在frmPeople中使用,通过键入姓氏的字母来选择特定的人。


frmDateDropDown。在frmPeople中用于使用日历控件选择日期。它有一个Text2文本框,其中传递了所选日期。


sfrmOffDetail是frmPeople中的子表单,其字段与tbleOffDet相同。这与CheckinID的主要表单相关联。所以当我在tblPeople中选择一条记录时,与子表单相关联的记录显示在子表单中。


我的问题是如何在frmDateDropDown中使用Text2中的日期来仅显示记录子表单中所选日期的当前人员。希望现在更加清晰。感谢。

Hi. I am relatively new in MS Access. I want to make an entry/edit form to enter the number of hours a person took off for a given day. In the form I have a person search button which I am able to choose the person from a tblPerson table, and a calendar to get a specific date. The table I want to update is tblHoursOff which contain the PersonID, DateOff, ( both are part of the primary key), HoursOff, Reason, Comment fields.

My problem is how to use the PersonID from the person search and the date I got from the calendar to show the record from the tblHoursOff if it is existing or enter a new record if not in it yet.

解决方案

The easiest way is to create a button. Lets call it cmdAddPerson.

Then you need the following code:

Expand|Select|Wrap|Line Numbers


Thanks, mmccarthy. I''ll try it out and will let you know the result. Thanks again.


Hi mmccarthy. Thanks agian. I placed your statements in. It works, but it pops up a window asking for a date. Sorry I didn?t make myself clear. Maybe, I should give more detailed specs. I have these tables and forms:

Tables.
tblPeople with the following fields PeopleID - autonum primary key, CheckinID, LastName, FirstName, Super, Type.

tblOffDetail with ChekinID , DateOff (these two make up the primary key), OffHours, OffType, Comments.

Forms:
frmPeople using tblPeople fields and a command button cmdPersonSearch to open another frmSearchPeople form when clicked.

frmSearchPeople. Used in frmPeople to select the specific person by typing the letters of the last name.

frmDateDropDown. Used in frmPeople to select the date using a calendar control. It has a Text2 textbox where the delected date is passed.

sfrmOffDetail is subform in the frmPeople with same fields as the tbleOffDet. This is linked to the main form by the CheckinID. So when I choose a record in the tblPeople records associated with it displays in the sub form.

My problem is how to use the date in Text2 in frmDateDropDown to show only the records for the current person for the selected date in the subform. Hope it is much clearer now. Thanks.


这篇关于访问表单问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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