加载记录(如果存在)。 [英] Load a record if it exists.

查看:78
本文介绍了加载记录(如果存在)。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


我已经为工作创建了一个数据库。现在最后一件事我需要它做但却无法理解它。我有一个表单,其中输入了新的详细信息,但我希望它检查现有记录并使用现有详细信息填充表单(如果有)。我有非常基本的vba或sql编码经验,无法在互联网上找到任何我想要做的事情。


该字段是一个订单号(主键)之前和之前它更新我希望它检查表中的exisitng记录。然后我希望它打开一个可以编辑的新表格,或用现有数据填充剩余的表格。


请帮助!我只是一个尽力而为的女孩!


谢谢

解决方案

你可以在之前更新事件使用DCount查看是否有任何具有该订单号的记录。如果有记录,您可以取消更新,然后使用DoCmd.FindRecord转到该记录。


感谢您的回复,这确实有帮助。但我该怎么做!整个事情我都非常密集。基本上,我需要放什么?


你说你有一些VBA经验所以我会给你一些骨架代码:

展开 < span class =codeDivider> | 选择 | Wrap | Line编号

hello,

i have created a database for work. there is now one last thing that i need it to do but cant get my head around it. i have a form where new details are entered, but i want it to check the existing records and populate the form with existing details, if there are any. i have very basic experience of coding in vba or sql and cant find anything on the internet that covers what im trying to do.

the field is an order number (primary key) and before it updates i want it to check the table for an exisitng record. i then want it to ether open a new form that can be edited, or to populate the remaing fields with the exisitng data.

PLEASE HELP! i''m just a girl trying her best!

Thanks

解决方案

You can, in the Before Update of the event use a DCount of see if there are any records with that order number. If there is a record, you can cancel the update and then use a DoCmd.FindRecord to go to that record.


Thank you for the reply, that does help. but how do i do that! i''m quite dense about the whole thing. basically, what would i need to put??


You said you had some VBA experience so I''ll give you some skeleton code:

Expand|Select|Wrap|Line Numbers


这篇关于加载记录(如果存在)。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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