使用where子句打开表单 [英] Open form using where clause

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

问题描述




问题的简单版本.....


我如何使用开放表格的where子句命令显示具有匹配ID的

帐户,以便在打开表单时显示?


例如。我在连续表单上选择一个记录,然后单击并编辑按钮。

该按钮运行打开的表单代码。我希望连续表格上的当前

记录的APPID与要打开的新表格上查看的记录的APPID相匹配




问题的复杂版本;


我有一个表格 - FRMAPPOINTMENTS,条目存储在表格中,

TBLAPPOINTMENTS。我有一个基于此表的查询QRYAPPOINTMENTS,

和基于此查询的连续表单 - FRMQUERYAPPOINTMENTS。

(这个奇怪的背后有一些(可能是有缺陷的!)逻辑设置)。


我想以连续形式FRMQUERYAPPOINTMENTS

选择一条记录,然后点击此表单上的编辑按钮打开表格

FRMAPPOINTMENTS在相应的记录中。两种形式的APPID匹配字段是




我在openform命令中尝试过多个where子句并且

没有运气。


谢谢,

解决方案

keri写道:
< blockquote class =post_quotes>



问题的简单版本.....


我如何使用open form命令的where子句显示一个

帐户,该帐户在打开表单时显示匹配的ID?


例如。我在连续表单上选择一个记录,然后单击并编辑按钮。

该按钮运行打开的表单代码。我希望连续表格上的当前

记录的APPID与要打开的新表格上查看的记录的APPID相匹配




问题的复杂版本;


我有一个表格 - FRMAPPOINTMENTS,条目存储在表格中,

TBLAPPOINTMENTS。我有一个基于此表的查询QRYAPPOINTMENTS,

和基于此查询的连续表单 - FRMQUERYAPPOINTMENTS。

(这个奇怪的背后有一些(可能是有缺陷的!)逻辑设置)。


我想以连续形式FRMQUERYAPPOINTMENTS

选择一条记录,然后点击此表单上的编辑按钮打开表格

FRMAPPOINTMENTS在相应的记录中。两种形式的APPID匹配字段是




我在openform命令中尝试过多个where子句并且

没有运气。


谢谢,



var =" Smith"

" ID =""" &安培; var& """


var = 1

" ID =" &安培; var


var =日期

" ID =#" &安培; var& "#"


假设您在FRMQUERYAPPOINTMENTS中有一个名为ID的字段。

的ID当前记录是您要在FRMAPPOINTMENTS中打开的ID号。

请记住,字符串用引号括起来,日期用#和数字

没有任何东西


Docmd.OpenForm" FRMAPPOINTMENTS" ,,," ID =" &安培;我。


感谢您的回复。但是我收到一个错误;


运行时错误3075

表达式中的语法错误(缺少运算符)" APPID =" &安培; Me.APPID


很抱歉没用。


我对此有另一种想法 - 表格我正在尝试打开

a子窗体(这是我需要查看的唯一位),但子窗体

条目基于主窗体中的选择因此原因我

无法查看子表单中的约会。


所以,我根据约会创建了另一个约会表单

表。所以我把我的开放式命令行改为:


DoCmd.OpenForm" APPOINTMENTS",," APPID =" &安培; Me.APPID


我现在得到;


运行时错误2501


openform动作被取消


Hi,

Simple version of the question.....

How do I use the where clause of the open form command to show an
account with a matching ID to be displayed when the form is opened?

Eg. I select a record on a continuous form and click and edit button.
The button runs the open form code. I want the APPID of the current
record on the continous form to match the APPID of the record viewed
on the new form to be opened.

Complex version of the question;

I have a form - FRMAPPOINTMENTS with entries stored in a table,
TBLAPPOINTMENTS. I have a query based on this table QRYAPPOINTMENTS,
and a continuous form based on this query - FRMQUERYAPPOINTMENTS.
(There is some (probably flawed!) logic behind this bizarre setup).

I want to select a record in the continous form FRMQUERYAPPOINTMENTS
and by clicking on an edit button on this form to open the form
FRMAPPOINTMENTS at the corresponding record. The matching fields are
the APPID in both forms.

I have tried numerous where clauses in the openform command and having
no luck.

Thanks,

解决方案

keri wrote:

Hi,

Simple version of the question.....

How do I use the where clause of the open form command to show an
account with a matching ID to be displayed when the form is opened?

Eg. I select a record on a continuous form and click and edit button.
The button runs the open form code. I want the APPID of the current
record on the continous form to match the APPID of the record viewed
on the new form to be opened.

Complex version of the question;

I have a form - FRMAPPOINTMENTS with entries stored in a table,
TBLAPPOINTMENTS. I have a query based on this table QRYAPPOINTMENTS,
and a continuous form based on this query - FRMQUERYAPPOINTMENTS.
(There is some (probably flawed!) logic behind this bizarre setup).

I want to select a record in the continous form FRMQUERYAPPOINTMENTS
and by clicking on an edit button on this form to open the form
FRMAPPOINTMENTS at the corresponding record. The matching fields are
the APPID in both forms.

I have tried numerous where clauses in the openform command and having
no luck.

Thanks,

var = "Smith"
"ID = """ & var & """

var = 1
"ID = " & var

var = Date
"ID = #" & var & "#"

Let''s say you have a field called ID in FRMQUERYAPPOINTMENTS. The ID of
the current record is the ID number you want to open in FRMAPPOINTMENTS.
Remember, strings are surrounded by quotes, dates by #, and numbers
with nothing

Docmd.OpenForm "FRMAPPOINTMENTS",,,"ID = " & Me.ID


Thanks for the reply. However I recieve an error;

Run time error 3075

Syntax error (missing operator) in expression "APPID =" & Me.APPID

Sorry for being fairly useless.


I have had another thought on this - the form I am trying to open has
a subform (which is the only bit I need to view), however the subform
entries are based on a selection from the main form hence the reason I
cannot view the appointment in the subform.

So, I have created another appointments form based on the appointments
table. So I have changed my open form command line thingy to;

DoCmd.OpenForm "APPOINTMENTS", , , "APPID = " & Me.APPID

I now get;

Run time error 2501

The openform action was cancelled


这篇关于使用where子句打开表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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