Access 2003:想要链接单独的表单以进行数据查看/输入 [英] Access 2003: Want to link a separate form for data viewing/entry

查看:86
本文介绍了Access 2003:想要链接单独的表单以进行数据查看/输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个模仿子表单动作的表单;即,当用户启动它时(通过带有标题''Program ...''的命令按钮),理论上新表单将被传递正在查看的记录的值,然后可以查看任何链接的数据,添加了新记录。但它不起作用。


这似乎不是很常见的事情。但是,我不知道还有什么可以继续进行,因为我的主表格上已经没空了!


我会试着更好地解释一下:


该项目是关于建筑物的各种细节的详细多层次列表。我的主要表单frm3ViewEditAddProperties包含一般信息部分和一系列选项卡;通常这些已正常使用正确链接的子表单等。我的一个标签专门用于一个名为frm4subfrmRooms的子表单(由父/子字段PropIndex链接),它以单一窗体的形式显示包含在导航按钮中的各个房间。它已经有一个名为frm5subsubRoomFunctions的子子窗体(由父/子字段RoomIndex链接),它显示了连续窗体中可能用于房间的合适功能。我需要添加的另一件事是在整个一周内在该房间内发生的事件计划。


这是我遇到麻烦的地方......我试图启动一个新表单frm6RoomProgramme,它将显示已在主窗体及其子窗体中选择的属性名称和房间名称,后跟一个连续视图子窗体,其中包含该房间中所有事件的详细信息。我已将此子表单调用frm7subfrmProgrammeListing并将主字段txtProgrammeRoomIndex(由与主窗体的子窗体中已显示的文本框txtRoomIndex匹配的房间的DLookUp生成的文本框)调用到子字段RoomIndex。


上面的方法意味着我可以读取已经存在的数据,但我无法弄清楚如何让它接受新数据,大概是因为它是基于DLookUp而不是绑定控件进行链接。除非我在表级别插入了某些内容,否则无论用户具有什么权限,子表单中都不会显示任何内容。第二种形式绑定到qry_tblRooms,所以我尝试添加一个直接反映主键的文本框(txtRoomIndex)(RoomIndex),但现在我看到了(AutoNumber)。文本在那里,所以我意识到它根本不受任何限制。


我尝试调整微软的代码,为用户建立一个最后查看设置(存储)在一个特殊的表格中),但我对记录集还不是很熟悉,所以我不知道这种方法是否完全转化。


任何人都可以帮忙吗?

I am trying to make a form that mimics the action of a subform; i.e., when the user launches it (via a command button with the caption ''Programme...''), theoretically the new form is passed the value of the record that was being viewed, and then any linked data can be viewed and new records added. But it doesn''t work.

This doesn''t seem to be a very common thing to do. However, I am not sure how else to proceed, as I''ve run out of room on my main form!

I''ll try to explain better:

The project is a detailed multi-level listing of various details about buildings. My main form, frm3ViewEditAddProperties, contains a general information section and a series of tabs; generally these have been working fine with correctly linked subforms etc. One of my tabs is devoted to a subform called frm4subfrmRooms (linked by parent/child fields PropIndex), which shows the various rooms contained in the building in single-form view with navigation buttons. It already has a sub-subform called frm5subsubRoomFunctions (linked by parent/child fields RoomIndex), which shows the suitable functions the room might be used for in continous-form view. The other thing I need to add is a programme of events that take place throughout the week within that room.

This is where I''ve run into trouble... I tried to launch a new form, frm6RoomProgramme, that would display the property name and room name already selected in the main form and its subform, followed by a continuous-view subform with details of all of the events in that room. I''ve called this subform frm7subfrmProgrammeListing and linked master field txtProgrammeRoomIndex (a textbox generated by a DLookUp of rooms matching textbox txtRoomIndex that is already displaying on the main form''s subform) to child field RoomIndex.

The approach above means I can read data that is already there, but I can''t figure out how to get it to accept new data, presumably because it is linking based on a DLookUp instead of a bound control. Unless I have inserted something at the table level, nothing at all shows in the subform, no matter what permissions the user has. This second form is bound to qry_tblRooms, so I tried adding a textbox (txtRoomIndex) that reflects the primary key directly (RoomIndex), but now I am seeing the "(AutoNumber)" text there, so I realised it is not bound to anything at all.

I tried adapting Microsoft''s code that establishes a ''last viewed'' setting for the user (stored in a special table), but I''m not very familiar with recordsets yet, so I don''t know if that sort of approach translates at all.

Can anyone help?

推荐答案

当你说

...但我无法弄清楚如何获得它接受新数据...
...but I can''t figure out how to get it to accept new data...



我认为这是一个文本框,您可以让用户输入最终保存到表中字段的内容。 .. 对?


如果是这样,那么你是正确的,你需要将它作为一个绑定字段。 "使用DLookup"是一个只读功能,不接受新的记录数据。您是否接受主表单或子表单上任何其他位置的用户输入数据?如果是这样你是如何完成这个的?

I assume that this is a textbox that you have for users to type something that ultimately saves to a field in your table.... right?

if so then you are correct that you need this to be a bound field. "DLookup" is a read only function and will not accept new record data. Are you accepting user inputted data anywhere else on your master forms or subforms? if so how are you accomplishing this?


是的,yarbrough,我确实需要将数据写入表中,但在这种情况下,用户不应该提供这个特定的值。它与tblRooms中的主键有关系,最终会隐藏控件。这就是为什么我需要它从第一种形式获得它的价值;这样,新数据将与正在显示的房间正确匹配,供以后参考。


绝对看不到将该步骤留在用户手中。


目前我有表格(命令按钮的目标形式,如果你愿意的话)绑定到tblRooms,它根本不需要添加新数据。也许我应该将目标表格解除绑定?我确实需要连续的子表单,以便用户可以一目了然地看到房间的整个程序(如果它有特别多的事件,则滚动)。在子窗体中是一个文本框(txtRoomIndex), 绑定到tblRoomProgrammes中的外键RoomIndex,我正在尝试使用该表填充的表。


是否可以对表单及其子表单使用相同的绑定表?这可能允许我将RoomIndex值传递给tblRoomProgrammes中的新条目吗?


感谢您的帮助!我正准备在这项任务上缺少时间,所以我希望在周末结束时能够找到解决方案。
Yes, yarbrough, I do need to write data to a table, but in this case the user should not be supplying this particular value. It has a relationship to the primary key in tblRooms and the control will eventually be hidden. That''s why I need it to get its value from the first form; that way, the new data will be correctly matched to the room that is displaying, for later reference.

Definitely cannot see leaving that step in the hands of the user.

At the moment I have the form (the command button''s target form, if you will) bound to tblRooms, which doesn''t need to have new data added at all. Maybe I should have the target form unbound? I do need the continous subform so that the user can see the room''s entire programme at a glance (or scroll if it has an escpecially high number of events). In the subform is a textbox (txtRoomIndex) that is bound to the foreign key RoomIndex in tblRoomProgrammes, the table that I''m trying to use the form to populate.

Is it possible to use the same bound table for both a form and its subform? Would that perhaps allow me to pass the RoomIndex value to the new entries in tblRoomProgrammes?

Thanks for your help! I''m strating to run short of time on this assignment and so am hoping that a solution can be worked out by the end of the weekend.


如果您需要做的就是猛拉来自第一个表单的值,然后使用此
If all you need to do is yank a value from the first form, then use this
展开 | 选择 | Wrap | 行号


这篇关于Access 2003:想要链接单独的表单以进行数据查看/输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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