帮助以DataSheet格式显示表 [英] Help Displaying Tables in DataSheet Format

查看:94
本文介绍了帮助以DataSheet格式显示表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MS Access表单,我有一个列表框列出了

表中的数据库。我希望能够点击任何这些表格并使用子表格或任何网格控件在同一表格上查看其内容。


我试了很多网格控件(DBGrid,DataGrid,MSFlexGrid),ADO

数据控件和我能想到的一切,都没有成功。这是

我面临的限制:


(1)手动填充任何网格控件对我来说太慢了

应用程序并且需要花费很多精力才能让用户编辑网格中的表格内容。

(2)使用子表单假设我已经知道了表结构,我不是.b $ b不要。

(3)使用ADODC不会让我连接到我正在工作的同一个mdb文件

on。


你能帮我找到最有效的(最少的开销是用于b / b
程序和使用)以数据表格式查看表格内容吗? $>
在MS Access中的同一表格上?


非常感谢您的建议。

解决方案

您可能会考虑的事情:

1.访问2000及更高版本,您可以使用ADO通过CurrentProject.Connection对象连接到当前的

数据库。


2.什么是动机坚持表格会在表格内显示

吗?

在自己的窗口打开桌子会很简单(在
$ b里面) $ b访问窗口,当然)使用DoCmd.OpenTable。


3.大多数程序员不允许他们的用户直接在

表中工作。 br />
如果用户在表格中工作,你会得到更好的控制。


HTH

- 海龟


阿拉丁 <一个***** @ yahoo.com>在消息中写道

news:20 ************************** @ posting.google.c om ...

我有一个MS Access表单,我有一个列表框列出了该数据库中的表。我希望能够点击任何这些表并使用子表单或任何网格控件在同一表单上查看其内容。

我尝试了很多网格控件(DBGrid,DataGrid,MSFlexGrid) ),ADO
数据控制和我能想到的一切,都没有成功。以下是我面临的限制:

(1)手动填充任何网格控件对于我的应用来说太慢了,并且需要花费很多精力才能让用户编辑网格中的表格内容。
(2)使用子表格假设我已经知道表格结构,我不会。
(3)使用ADODC赢了不要让我连接到我正在工作的同一个mdb文件。

你能不能帮我找到最有效的(最少的开销来编程和使用)方式在MS Access中的同一表格上查看数据表格式的表格内容?

非常感谢您的建议。



感谢您的回复,MacDermott。让我回答你的问题

澄清:


(1)我正在使用Access 2002& 2003.我尝试将

CurrentProjeect.Connection用于我正在开发的同一个mdb文件。

拒绝连接说该文件被锁定。

(2)我需要在同一表格上显示表格的内容。每条记录

都有一个地址,当用户遍历该表时,他们可以看到与该地址相关的

地图,必要时进行任何编辑并且

保存/取消,然后转到下一条记录。理想情况下,我想

使用一个子表单,我可以在单个和多个记录视图之间切换

(单个与数据表),但问题是表单假设我知道

表'的结构apriori。打开多个模态/非模态形式

会让我的用户感到困惑,除非你告诉我如何使它们看起来像

一种形式。


(3)我之所以决定使用MS Access''运行时进行开发

而不是纯VB,首先是导入/导出功能

,允许用户导入/导出表。这就是我将

表导入本地(相同)mdb文件的原因。我不需要任何系统表,

,即使我这样做,我也可以很容易地将其隐藏起来。这样,

用户仍然可以使用MS Access的强大功能以及添加的功能

的映射地址,无论它们存储在何处。


我真的很感激,如果你可以指导我最简单的方式来获得一个子表单来打开DataSheet格式的任何表格,无论

的架构,或者任何其他允许读/写数据绑定到基础表的方法,给出上述信息。


Aladdin Nassar


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

不要只是参加USENET ......获得奖励!


还有一些想法:

(1)您的数据库是否可以在独占模式下打开? (如果它在

共享模式下打开,则在同一个文件夹中会有一个同名的.ldb文件

与你的mdb;在独占模式下,有没有.ldb文件。)在独家

模式下,我不希望允许其他使用相同的连接。


(2)很抱歉成为如此密集,但我还没有很好地了解你想要完成的是什么



听起来好像你是进口品种表格,各种

桌面结构。

但是,每张桌子都有地址和地图信息。

我不觉得你可以在数据表视图中显示地图(某种图形,大概是
)。

除非你有办法识别出的名字。包含

图形的字段,您将很难在通用表单上显示此字段,




在你提到地图之前,我想到了这一点:

在变量MyTable中选择了一个表名,

DoCmd.OpenTable" MyTable"
DoCmd.Maximize

如果你已经在最大化模式下工作,那么第二行就不会是
必需的。

你的桌子应该显示,占据整个屏幕。

用户可以在其中工作,然后在完成后关闭它,返回到您的

屏幕。

当然是复杂的用户可以通过这种设计进行恶作剧,但是我没有看到你描述的初级用户会如何混淆。


如果你有一组表格不会改变,你可以为每一个表单创建一个单独的

表格,然后在一个子表格中显示相应的表格

控制你的表格表单,通过更改子窗体控件的ControlSource

属性。

但是如果您希望导入更多表单,还有尚未定义的表格

structu res,这也没有帮助。

或者至少它不会解决整个问题。


在数据表和单一表格之间切换查看并不太难,我想,使用DoCmd.RunCommand acCmdDataSheetView和DoCmd.RunCommand

acCmdFormView。


(3 )我不确定我是否遵循你的逻辑拒绝VB,或选择Access,

但我希望以上对你有用。

我如果我更清楚地了解你的桌子来自哪里以及你想要用什么用于他们的

数据,我可能会更好地建议你。


HTH

- 海龟


" Aladdin Nassar" <一个***** @ yahoo.com>在消息中写道

news:40 ********************* @ news.frii.net ...

感谢您的回复,MacDermott。让我回答你的问题以澄清:

(1)我正在使用Access 2002& 2003.我尝试将
CurrentProjeect.Connection用于我正在开发的同一个mdb文件。它拒绝连接说文件被锁定。

(2)我需要显示表格的内容在同一表格上。每个记录都有一个地址,当用户遍历表格时,他们可以看到与该地址相关的地图,必要时进行任何编辑并保存/取消,然后再转到下一个记录。理想情况下,我想使用一个子表单,我可以在单个和多个记录视图之间切换
(单个与数据表格),但问题是表单假设我知道表格'apriori的结构。打开多个模态/非模态形式会让我的用户感到困惑,除非你告诉我如何使它们看起来像一个表格。

(3)我之所以决定使用MS Access''运行时进行开发
首先是纯VB,是导入/导出功能,允许用户导入/导出表。这就是我将
表导入本地(相同)mdb文件的原因。我不需要任何系统表,
即使我这样做,我也可以轻松地将其隐藏起来。这样,
用户仍然可以使用MS Access的强大功能以及映射地址的附加功能,无论它们存储在何处。

如果您能指导我真的很感激我最简单的方法是获得一个子表单以打开DataSheet格式的任何表格,无论其架构如何,或者允许读/写数据绑定到基础表格的任何其他方式,鉴于上述信息。

Aladdin Nassar

***通过Developersdex发送
http://www.developersdex.com ***
不要只是参加USENET ......获得奖励!



I have an MS Access form on which I have a listbox listing tables in
that database. I want to be able to click on any of those tables and
view its contents on the same form using subforms or any grid control.

I tried many grid controls (DBGrid, DataGrid, MSFlexGrid), the ADO
Data Control and everything I can think of, with no success. Here are
the contraints I faced:

(1) Populating any of the grid controls manually is too slow for my
application and takes a lot of effort to allow the user to edit the
table contents in the grid.
(2) Using subforms assumes I already know the table structure, which I
don''t.
(3) Using ADODC won''t let me connect to the same mdb file I am working
on.

Can you please help me find the most efficient (least overhead to
program and use) way to view the table contents in Dataseheet format
on the same form in MS Access ?

Your advise is greatly appreciated.

解决方案

Couple of things you might consider:
1. Access versions 2000 and later let you use ADO to connect to the current
database using the CurrentProject.Connection object.

2. What is the motivation behind insisting that the tables be displayed
inside the form?
It would be quite simple to open the table in its own window (inside the
Access window, of course) using DoCmd.OpenTable.

3. Most programmers do not allow their users to work directly in the
tables.
You get much finer control if users work in forms.

HTH
- Turtle

"Aladdin" <an*****@yahoo.com> wrote in message
news:20**************************@posting.google.c om...

I have an MS Access form on which I have a listbox listing tables in
that database. I want to be able to click on any of those tables and
view its contents on the same form using subforms or any grid control.

I tried many grid controls (DBGrid, DataGrid, MSFlexGrid), the ADO
Data Control and everything I can think of, with no success. Here are
the contraints I faced:

(1) Populating any of the grid controls manually is too slow for my
application and takes a lot of effort to allow the user to edit the
table contents in the grid.
(2) Using subforms assumes I already know the table structure, which I
don''t.
(3) Using ADODC won''t let me connect to the same mdb file I am working
on.

Can you please help me find the most efficient (least overhead to
program and use) way to view the table contents in Dataseheet format
on the same form in MS Access ?

Your advise is greatly appreciated.



Thank you for your reply, MacDermott. Let me answer your questions to
clarify:

(1) I am using Access 2002 & 2003. I tried using
CurrentProjeect.Connection to the same mdb file I am developing in. It
refused connection saying the file was locked.

(2) I need to show the table''s contents on the same form. Each record
has an address, and as the user traverses the table, they get to see the
map associated with that address, make any edits if necessary and
save/cancel before moving to the next record. Ideally, I would like to
use a subform that I can switch between single and mulitple record view
(Single vs. Dataseheet), but the problem is that the form assumes I know
the table''s structure apriori. Opening multiple modal/non-modal forms
would confuse my users, unless you tell me how to make them look like
one form.

(3) The reason why I decided to use MS Access'' runtime for development
instead pure VB in the first place, is the import/export functionality
that allows the users to import/export tables. That is why I import
tables into the local (same) mdb file. I don''t need any system tables,
and even if I did, I can easily hide it from the user. That way the
user can still use the power of MS Access plus the added functionality
of mapping addresses no matter where they are stored.

I would really appreciate if you can direct me to the easiest way to
either get a subform to open any table in DataSheet format irrespective
of its schema, or any other way that allows read/write data-binding to
the underlying table, given the above information.

Aladdin Nassar

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!


A few more thoughts:
(1) Is your database perhaps open in exclusive mode? (If it is open in
shared mode, there will be an .ldb file of the same name in the same folder
with your mdb; in exclusive mode, there is no .ldb file.) In exclusive
mode, I would not expect other use of the same connection to be permitted.

(2) Sorry to be so dense, but I still don''t have a very good picture of what
you''re trying to accomplish.
It sounds as if you are importing a variety of tables, with a variety of
table structures.
However, each table has address and map information.
I don''t think you''re going to be able to display maps (some sort of graphic,
presumably) in datasheet view.
Unless you have some way of identifying the name of the field containing the
graphic, you''ll have a hard time displaying this field on a generic form,
either.

Until you mentioned the maps, I had this in mind:
Having selected a table name into a variable MyTable,
DoCmd.OpenTable "MyTable"
DoCmd.Maximize
If you''re already working in maximized mode, the second line won''t be
necessary.
Your table should display, taking up the entire screen.
The user can work in it, then close it when he''s finished, returning to your
screen.
Of course a sophisticated user can get into mischief with this design, but I
don''t see how it would be confusing for the beginning user you describe.

If you have a set of tables which won''t change, you could create a separate
form for each one, then display the appropriate one in a single subform
control on your form, by changing the subform control''s ControlSource
property.
But if you expect to be importing more forms, with as yet undefined table
structures, this won''t help, either.
Or at least it won''t solve the entire problem.

Switching between datasheet and single form view is not too difficult, I
think, using DoCmd.RunCommand acCmdDataSheetView and DoCmd.RunCommand
acCmdFormView.

(3) I''m not sure I follow your logic in rejecting VB, or selecting Access,
but I do hope that the above is of some use to you.
I might be able to advise you better if I had a clearer understanding of
where your tables are coming from and what use you want to make of their
data.

HTH
- Turtle

"Aladdin Nassar" <an*****@yahoo.com> wrote in message
news:40*********************@news.frii.net...

Thank you for your reply, MacDermott. Let me answer your questions to
clarify:

(1) I am using Access 2002 & 2003. I tried using
CurrentProjeect.Connection to the same mdb file I am developing in. It
refused connection saying the file was locked.

(2) I need to show the table''s contents on the same form. Each record
has an address, and as the user traverses the table, they get to see the
map associated with that address, make any edits if necessary and
save/cancel before moving to the next record. Ideally, I would like to
use a subform that I can switch between single and mulitple record view
(Single vs. Dataseheet), but the problem is that the form assumes I know
the table''s structure apriori. Opening multiple modal/non-modal forms
would confuse my users, unless you tell me how to make them look like
one form.

(3) The reason why I decided to use MS Access'' runtime for development
instead pure VB in the first place, is the import/export functionality
that allows the users to import/export tables. That is why I import
tables into the local (same) mdb file. I don''t need any system tables,
and even if I did, I can easily hide it from the user. That way the
user can still use the power of MS Access plus the added functionality
of mapping addresses no matter where they are stored.

I would really appreciate if you can direct me to the easiest way to
either get a subform to open any table in DataSheet format irrespective
of its schema, or any other way that allows read/write data-binding to
the underlying table, given the above information.

Aladdin Nassar

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!



这篇关于帮助以DataSheet格式显示表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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