表单数据源 [英] Form Data Source

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

问题描述




我有4个查询,所有4个查询都使用不同的表格,并且不同的列拉



是否可以使用一个通用的all purpose表单(frmGeneral)和

,在运行时将fly设置frmGeneral的数据源到这些

查询中的任何一个:

qry1,qry2,qry3或qry 4在向用户显示表单之前?


一旦表单加载并在视图中,数据源是否可以如果用户选择查看另一个查询的结果,则启用

?我尝试了这个但是在设计新表单时,下一步是将

字段拖到表单上。我不想这样做。我只想动态更改

数据源。


我的全部理由是减少维护而只需要

维护一个表单而不是四个近似重复的表单。


谢谢。

***通过Developersdex发送 http://www.developersdex.com ***

解决方案

您可以在

表格的公开事件中设置记录源(您的任何查询):

选择Case DecidingFactorForWhichQuery

案例因素1值

Me.Recordsource =" NameOfQuery1"

案例因子2值

Me.Recordsource =" ; NameOfQuery2"


等....

结束选择


然后设置控件的控件来源表单:

Select Case DecidingFactorForWhichQuery

Case Factor1 Value

Me!Field1 .ControlSource =" NameOfQueryField1"

Me!Field2.ControlSource =" NameOfQueryField2"

Me!Field3.ControlSource ="" ''不在表格上使用字段

Case Factor2 Value

Me!Field1.ControlSource ="" ''不在表格上使用字段

Me!Field2.ControlSource ="" ''不在表格上使用字段

Me!Field3.ControlSource =" NameOfQueryField3"

Me!Field4.ControlSource =" NameOfQueryField4"


等......

结束选择


Steve

" RLN" < no ******* @ devdex.comwrote in message

news:12 ************** @ news.newsfeeds.com ...


>


我有4个查询,所有4个查询都使用不同的表格并拉动

不同的列。


是否有可能有一个通用的所有用途表格(frmGeneral)和

在运行时的飞行设置frmGeneral的数据在向用户显示表格之前,要求这些

查询:

qry1,qry2,qry3或qry 4?


一旦表单加载并在视图中,如果用户选择查看另一个查询的结果,是否可以打开数据源?b
?我尝试了这个但是在设计新表单时,下一步是将

字段拖到表单上。我不想这样做。我只想动态更改

数据源。


我的全部理由是减少维护而只需要

维护一个表格而不是四个近似复制的表格。


谢谢。


***通过开发人员指南 http://www.developersdex.com ***




" Mark" < no *** @ email.comschreef在bericht新闻:xL ****************************** @ earthlink.co m ...


您可以在

表格的公开事件中设置记录源(您的任何查询):

Select Case DecidingFactorForWhichQuery

Case Factor1 Value

Me.Recordsource =" NameOfQuery1"

Case Factor2 Value

Me.Recordsource =" NameOfQuery2"

等....

结束选择


然后在表单上设置控件的控件来源:

Select Case DecidingFactorForWhichQuery

Case Factor1 Value

Me!Field1.ControlSource =" NameOfQueryField1"

Me!Field2.ControlSource =" NameOfQueryField2"

Me!Field3.ControlSource ="" ''不在表格上使用字段

Case Factor2 Value

Me!Field1.ControlSource ="" ''不在表格上使用字段

Me!Field2.ControlSource ="" ''不在表格上使用字段

Me!Field3.ControlSource =" NameOfQueryField3"

Me!Field4.ControlSource =" NameOfQueryField4"


等....

结束选择


Steve



-

嘿Mark / Steve !!我们在这里不需要你!

嘿Mark / Steve !!我们不要你在这里!!


这是告诉''newbees''这里关于PCD''史蒂夫:
http://home.tiscali.nl/arracom/whoissteve.html (更新,主要是''滥用报告''页面......)

到目前为止,5850多个页面加载,3675 ​​+首次访问者

(这些数字是真实且迅速增加的)


为什么这是???

因为史蒂夫是这里唯一一个继续在小组中做广告的人。


他是否在*这个*特定的帖子上做广告是不相关的...

==我们希望他知道这些团体不是*他的私人狩猎场!


对于那些不喜欢看到所有这些消息的人:

==简单地杀死文件''StopThisAdvertising''。

Newbees仍然会看到这条警告信息。


ArnoR


当然,如果您需要在控件的'AfterUpdate事件或表单'的BeforeUpdate事件中进行任何类型的数据验证或操作

,那么你将需要
通过确定目前使用的是哪个记录来源来确定这些资格。


我必须告诉你,长期,我认为你'会发现你要去

增加你花在维护上的时间,而不是减少它。


-

总是有不止一种方法给猫皮肤!


基于Access 2000/2003的答案/帖子


留言通过AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200807/1




I have 4 queries and all 4 queries use different tables and pull
different columns.

Is it possible to have one Generic all Purpose form (frmGeneral) and on
the fly at run time set frmGeneral''s data source to any of these
queries:
qry1, qry2, qry3 or qry 4 before showing the form to the user?

Once the form is loaded and in view, can the data source be switched on
the fly if the users elects to see the results of another query? I
tried this but when designing the new form the next step was to drag
fields on to the form. I don''t want to do this. I just want to change
data sources on the fly.

My whole reason for this is to cut down on maintenance and only have to
maintain one form instead of four near-duplicate-in-appearance forms.

Thanks.
*** Sent via Developersdex http://www.developersdex.com ***

解决方案

You can set the recordsource (any of your queries) in the open event of the
form with:
Select Case DecidingFactorForWhichQuery
Case Factor1 Value
Me.Recordsource = "NameOfQuery1"
Case Factor2 Value
Me.Recordsource = "NameOfQuery2"

etc ....
End Select

Then set the controlsource of controls on your form with:
Select Case DecidingFactorForWhichQuery
Case Factor1 Value
Me!Field1.ControlSource = "NameOfQueryField1"
Me!Field2.ControlSource = "NameOfQueryField2"
Me!Field3.ControlSource = "" '' Does not use field on form
Case Factor2 Value
Me!Field1.ControlSource = "" '' Does not use field on form
Me!Field2.ControlSource = "" '' Does not use field on form
Me!Field3.ControlSource = "NameOfQueryField3"
Me!Field4.ControlSource = "NameOfQueryField4"

etc ....
End Select

Steve
"RLN" <no*******@devdex.comwrote in message
news:12**************@news.newsfeeds.com...

>

I have 4 queries and all 4 queries use different tables and pull
different columns.

Is it possible to have one Generic all Purpose form (frmGeneral) and on
the fly at run time set frmGeneral''s data source to any of these
queries:
qry1, qry2, qry3 or qry 4 before showing the form to the user?

Once the form is loaded and in view, can the data source be switched on
the fly if the users elects to see the results of another query? I
tried this but when designing the new form the next step was to drag
fields on to the form. I don''t want to do this. I just want to change
data sources on the fly.

My whole reason for this is to cut down on maintenance and only have to
maintain one form instead of four near-duplicate-in-appearance forms.

Thanks.
*** Sent via Developersdex http://www.developersdex.com ***




"Mark" <no***@email.comschreef in bericht news:xL******************************@earthlink.co m...

You can set the recordsource (any of your queries) in the open event of the
form with:
Select Case DecidingFactorForWhichQuery
Case Factor1 Value
Me.Recordsource = "NameOfQuery1"
Case Factor2 Value
Me.Recordsource = "NameOfQuery2"

etc ....
End Select

Then set the controlsource of controls on your form with:
Select Case DecidingFactorForWhichQuery
Case Factor1 Value
Me!Field1.ControlSource = "NameOfQueryField1"
Me!Field2.ControlSource = "NameOfQueryField2"
Me!Field3.ControlSource = "" '' Does not use field on form
Case Factor2 Value
Me!Field1.ControlSource = "" '' Does not use field on form
Me!Field2.ControlSource = "" '' Does not use field on form
Me!Field3.ControlSource = "NameOfQueryField3"
Me!Field4.ControlSource = "NameOfQueryField4"

etc ....
End Select

Steve


--
Hey Mark/Steve!! We don''t need you here !!
Hey Mark/Steve!! We don''t want you here !!

This is to inform ''newbees'' here about PCD'' Steve:
http://home.tiscali.nl/arracom/whoissteve.html (updated, mainly the ''abuse-reporting'' page...)
Until now 5850+ pageloads, 3675+ first-time visitors
(these figures are real and rapidly increasing)

Why is this ???
Because Steve is the ONLY person here who continues to advertise in the groups.

It is not relevant whether he advertised in *this* particular post or not...
==We want him to know that these groups are *not* his private hunting grounds!

For those who don''t like too see all these messages:
==Simply killfile ''StopThisAdvertising''.
Newbees will still see this warning-message.

ArnoR


And, of course, if you need to do any type of data validation or manipulation
in the controls'' AfterUpdate events or the form''s BeforeUpdate event, you''ll
have to qualify these as well by identifying which record source is currently
being used.

I''ve got to tell you, long term, I think you''ll find that you''re going to
increase your time spent on maintenance, not decrease it.

--
There''s ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200807/1


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

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