为从Access中的列表视图选择的客户添加订单 [英] Adding an order for a customer selected from a list view in Access

查看:97
本文介绍了为从Access中的列表视图选择的客户添加订单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了这份出色的指南,可帮助我向Access数据库添加搜索功能:

I followed this great guide to help me add a search feature to my Access database:

最后说:

如果要建立报价或订单,请使用列表控件的Click或Double Click事件将记录复制到临时表中.对于每个搜索任务,使用固定查询很容易实现."

"If you’re building a quote or order, use the list control’s Click or Double Click event to copy record(s) to a temporary table. It’s easy to implement using a fixed query for each search task."

我设法将所有搜索结果显示在列表框中,并且我希望能够点击某个客户以突出显示它们,然后按下一个按钮以向所选客户添加订单.

我一直在思考如何做到这一点,但我实在无法克服.

I have managed to display all search results in a list box and I would like to be able to click on a customer to highlight them, and then press a button to add an order to the selected customer. I've been thinking how I could do it and I really can't get my head around it.

任何帮助将不胜感激.

推荐答案

这取决于您如何构建数据库.我的猜测是一种简单的方法是:

It depends on how you build your database. My guess is that one easy way would be:

  • 与客户创建表;
  • 创建一个包含订单的订单"表,您可以在该表中通过外键链接客户
  • 您将客户加载到列表框中.使名称可见时,它实际上是您单击列表框时检索到的ID.您可以在表的设计视图中通过向导进行配置.您可以使其他表单通过列表框上的事件显示(例如,单击时).
  • 如果您设法检索了客户的ID,并且您拥有与订单相关的数据(可以轻松地从表单对象中提取数据并将其加载到变量中),那么您需要的是一条插入语句,并将值插入到订单"表(包括通过外键链接的客户ID).
  • 这样,所有订单记录都链接到客户,以后可以查询.

由于我对您的其他要求的了解有限,因此我无法在其余数据库设计方面进一步为您提供帮助. 希望我的答复能对您有所帮助,也希望我能正确理解您的问题.

Due to my limited knowledge on your other requests, I cannot help you any further on the rest of your database design. I hope that my reply could help you and that I understood your question correctly.

这篇关于为从Access中的列表视图选择的客户添加订单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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