如何检索表单上的子记录 [英] how to retrieve records submmited on a form

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

问题描述

大家好,


我为设备创建了一个数据库。我有一个表格来注册

设备,意思是填写所有细节(ID,序列号,类型,

位置等)。我在表格末尾有两个按钮,即

提交和取消。单击提交后,信息将直接存储到相应的数据库表中。我的问题在这里

我需要检索提交的信息,以显示用户输入的所有

数据,例如


*感谢您提交。

您提交的详细信息如下

id:00125

名称:machine

位置:马来西亚


请帮忙,因为我急需这么做而且时间不多了。


非常感谢! !

解决方案

Kev,你还没有告诉我们你为什么这么做。


只需创建一个绑定到表格的表格。无需任何代码,

按钮,或绑定以检索数据。您可以使用表单底部的内置导航

按钮移动到新记录,输入它,并且它可以保存并显示没有任何代码的



-

Allen Browne - 微软MVP。西澳大利亚珀斯

访问用户提示 - http:// allenbrowne .com / tips.html

回复群组,而不是mvps dot org的allenbrowne。


" kev" < ke ****** @ gmail.com在留言中写道

新闻:11 ********************* @ j72g2000cwa。 googlegro ups.com ...


>

我已经为设备创建了一个数据库。我有一个表格来注册

设备,意思是填写所有细节(ID,序列号,类型,

位置等)。我在表格末尾有两个按钮,即

提交和取消。单击提交后,信息将直接存储到相应的数据库表中。我的问题在这里

我需要检索提交的信息,以显示用户输入的所有

数据,例如


*感谢您提交。

您提交的详细信息如下

id:00125

名称:machine

位置:马来西亚


请帮忙,因为我急需这么做而且时间不多了。


非常感谢! !



嗨艾伦,


感谢您的快速回复,但我仍然没有得到解决方案

我的问题。

让我再解释一下。

一旦用户填写了设备登记表,那么

点击提交,我希望输入的数据显示在下一页/表格中。

我只想显示当前记录而不是所有记录...

i已禁用内置导航按钮,因为我只想一次显示一条

记录。(我不希望用户查看

其他记录)


我确实使用了你下面建议的方法,但它没有显示

正确的记录,而是从数据库中随机显示任何记录。


请尽快回复,因为我的项目非常依赖于此...


再次感谢并为造成的任何不便表示歉意


Allen Browne写道:

Kev,你还没有告诉我们你为什么这么做。


只需创建一个绑定到你桌子的表格。无需任何代码,

按钮,或绑定以检索数据。您可以使用表单底部的内置导航

按钮移动到新记录,输入它,并且它可以保存并显示没有任何代码的



-

Allen Browne - 微软MVP。西澳大利亚珀斯

访问用户提示 - http:// allenbrowne .com / tips.html

回复群组,而不是mvps dot org的allenbrowne。


" kev" < ke ****** @ gmail.com在留言中写道

新闻:11 ********************* @ j72g2000cwa。 googlegro ups.com ...



我已经为设备创建了一个数据库。我有一个表格来注册

设备,意思是填写所有细节(ID,序列号,类型,

位置等)。我在表格末尾有两个按钮,即

提交和取消。单击提交后,信息将直接存储到相应的数据库表中。我的问题在这里

我需要检索提交的信息,以显示用户输入的所有

数据,例如


*感谢您提交。

您提交的详细信息如下

id:00125

名称:machine

位置:马来西亚


请帮忙,因为我急需这么做而且时间不多了。


非常感谢! !


Kev,请记住我们不知道:

- 涉及多少桌子,

- 涉及哪些主键和外键,

- 如何提交数据,

- 如何检索数据和填充未绑定表格上的控件。


因此无法就您需要的流程提供建议。


以下示例说明如何使用Append查询语句将

a记录写入表中,然后检索AutoNumber值。希望你

知道如何在那个特定的记录上打开OpenRecordset,你可以将

也应用相同的方法到相关的表格中来回答

你个人的问题可能存在。请注意,这个

至少需要Access 2000.


函数ShowIdentity()As Variant

Dim db As DAO.Database

Dim rs As DAO.Recordset


设置db = DBEngine(0)(0)

db.Execute" INSERT INTO MyTable(MyField)SELECT''nuffin''AS Expr1;"


设置rs = db.OpenRecordset(" SELECT @@ IDENTITY AS LastID;")

ShowIdentity = rs!LastID

rs.Close


设置rs =无什么

设置db = Nothing

结束功能


-

Allen Browne - 微软MVP。西澳大利亚珀斯

访问用户提示 - http:// allenbrowne .com / tips.html

回复群组,而不是mvps dot org的allenbrowne。


" kev" < ke ****** @ gmail.com写信息

新闻:11 ********************** @ f1g2000cwa .googlegro ups.com ...


嗨艾伦,


感谢您的快速回复,但我仍然没有得到解决方案

我的问题。

让我再解释一下。

一旦用户填写了设备登记表,那么

点击提交,我希望输入的数据显示在下一页/表格中。

我只想显示当前记录而不是所有记录......

i已禁用内置导航按钮,因为我只想一次显示一条

记录。(我不希望用户查看

其他记录)


我确实使用了你下面建议的方法,但它没有显示

正确的记录,而是从数据库中随机显示任何记录。


请尽快回复,因为我的项目非常依赖于此......


T hanks再次抱歉造成的任何不便


Allen Browne写道:


> Kev,你还没有告诉我们为什么你正在努力做到这一点。

只需创建一个绑定到你的表格的表格。无需任何代码,
按钮或绑定以检索数据。您可以使用表单底部的内置
导航
按钮移动到新记录,输入它,并在没有任何代码的情况下保存和显示它们。

kev < ke ****** @ gmail.com写信息
新闻:11 ********************* @ j72g2000cwa.googlegr psps.com ...


>

我已经为设备创建了一个数据库。我有一个表格来注册

设备,意思是填写所有细节(ID,序列号,类型,

位置等)。我在表格末尾有两个按钮,即

提交和取消。单击提交后,信息将直接存储到相应的数据库表中。我的问题在这里

我需要检索提交的信息,以显示用户输入的所有

数据,例如


*感谢您提交。

您提交的详细信息如下

id:00125

名称:machine

位置:马来西亚


请帮忙,因为我急需这么做而且时间不多了。


非常感谢! !



Hi all,

I have created a database for equipments. I have a form to register the
equipment meaning filling in all the particulars (ID, serial, type,
location etc). I have two buttons at the end of the form which is
submit and cancel. After i have clicked submit, the information is
stored directly into my corresponding database table. My problem here
is i need to retrieve back the information submitted to display all the
data that the user has input in something like

*Thank you for submitting.
Your details submitted is as below
id:00125
name:machine
location:malaysia

Please help as i need to do it urgently and am running out of time.

Thanks a lot!!

解决方案

Kev, you have not told us why you are doing this the hard way.

Just create a form bound to your table. There is no need for any code,
button, or tying to retrieve the data. You can use the built-in navigation
buttons at the bottom of the form to move to a new record, enter it, and it
saves and displays without any code.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"kev" <ke******@gmail.comwrote in message
news:11*********************@j72g2000cwa.googlegro ups.com...

>
I have created a database for equipments. I have a form to register the
equipment meaning filling in all the particulars (ID, serial, type,
location etc). I have two buttons at the end of the form which is
submit and cancel. After i have clicked submit, the information is
stored directly into my corresponding database table. My problem here
is i need to retrieve back the information submitted to display all the
data that the user has input in something like

*Thank you for submitting.
Your details submitted is as below
id:00125
name:machine
location:malaysia

Please help as i need to do it urgently and am running out of time.

Thanks a lot!!



Hi Allen,

Thank you for a quick reply but i am still not getting the solution for
my problem.
Let me explain again.
Once the user have filled in up the equipment registration form then
click submit, i want the data inputted shown in the next page/form.
I want only the current record to be displayed and not all records...
i have disabled the built-in navigation buttons as i only want one
record to be displayed at one time.(i do not want the user to view
other records)

I did use the method you suggested below but it is not displaying the
correct record instead it shows any record at random from the database.

Pls reply asap as my project relies very much on this..

Thanks again and sorry for any inconveniences caused

Allen Browne wrote:

Kev, you have not told us why you are doing this the hard way.

Just create a form bound to your table. There is no need for any code,
button, or tying to retrieve the data. You can use the built-in navigation
buttons at the bottom of the form to move to a new record, enter it, and it
saves and displays without any code.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"kev" <ke******@gmail.comwrote in message
news:11*********************@j72g2000cwa.googlegro ups.com...


I have created a database for equipments. I have a form to register the
equipment meaning filling in all the particulars (ID, serial, type,
location etc). I have two buttons at the end of the form which is
submit and cancel. After i have clicked submit, the information is
stored directly into my corresponding database table. My problem here
is i need to retrieve back the information submitted to display all the
data that the user has input in something like

*Thank you for submitting.
Your details submitted is as below
id:00125
name:machine
location:malaysia

Please help as i need to do it urgently and am running out of time.

Thanks a lot!!


Kev, bear in mind that we don''t know:
- how many tables are involved,
- what primary keys and foreign keys are involved,
- how you submit the data,
- how you retrieve the data and populate the controls on your unbound form.

It is therefore impossible to advise you on what process you need.

The example below illustrates how to use an Append query statement to write
a record to a table, and then retrieve the AutoNumber value. Hopefully you
know how to OpenRecordset on that particular record from there, and you can
also apply the same approach to the related tables where the answers to the
individual questions in your survery are presumably stored. Note that this
requires at least Access 2000.

Function ShowIdentity() As Variant
Dim db As DAO.Database
Dim rs As DAO.Recordset

Set db = DBEngine(0)(0)
db.Execute "INSERT INTO MyTable ( MyField ) SELECT ''nuffin'' AS Expr1;"

Set rs = db.OpenRecordset("SELECT @@IDENTITY AS LastID;")
ShowIdentity = rs!LastID
rs.Close

Set rs = Nothing
Set db = Nothing
End Function

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"kev" <ke******@gmail.comwrote in message
news:11**********************@f1g2000cwa.googlegro ups.com...

Hi Allen,

Thank you for a quick reply but i am still not getting the solution for
my problem.
Let me explain again.
Once the user have filled in up the equipment registration form then
click submit, i want the data inputted shown in the next page/form.
I want only the current record to be displayed and not all records...
i have disabled the built-in navigation buttons as i only want one
record to be displayed at one time.(i do not want the user to view
other records)

I did use the method you suggested below but it is not displaying the
correct record instead it shows any record at random from the database.

Pls reply asap as my project relies very much on this..

Thanks again and sorry for any inconveniences caused

Allen Browne wrote:

>Kev, you have not told us why you are doing this the hard way.

Just create a form bound to your table. There is no need for any code,
button, or tying to retrieve the data. You can use the built-in
navigation
buttons at the bottom of the form to move to a new record, enter it, and
it
saves and displays without any code.

"kev" <ke******@gmail.comwrote in message
news:11*********************@j72g2000cwa.googlegr oups.com...

>
I have created a database for equipments. I have a form to register the
equipment meaning filling in all the particulars (ID, serial, type,
location etc). I have two buttons at the end of the form which is
submit and cancel. After i have clicked submit, the information is
stored directly into my corresponding database table. My problem here
is i need to retrieve back the information submitted to display all the
data that the user has input in something like

*Thank you for submitting.
Your details submitted is as below
id:00125
name:machine
location:malaysia

Please help as i need to do it urgently and am running out of time.

Thanks a lot!!



这篇关于如何检索表单上的子记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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