Access 2007 Combobox 显示表格中的错误结果 [英] Access 2007 Combobox displaying wrong results from table

查看:54
本文介绍了Access 2007 Combobox 显示表格中的错误结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有四个链接到 SQL 表的组合框,然后它们链接到一个日志表.

I have four ComboBoxes that are linked to SQL Tables and then they are linked to a log table.

我遇到的问题是组合框显示了正确的选项,但只记录了 ID 值.

The problem I have is that the combobox is displaying the correct options but only logging the ID value.

假设我有一个名为 Location 的组合框,它有 3 个位置:

So say I have a combobox called Location and it has 3 locations:

Cape Town
Dallas
London

combobox正在下拉下来显示那些3个选择,但是当记录选择时,它只会返回值1,2或3而不是城市

The ComboBox is showing those 3 choices in the drop down but when the choice is logged it will only return the values 1,2 or 3 and not the cities

这是行源:

SELECT Location.ID, Location.Location FROM Location ORDER BY Location.ID, Location.Location; 

但是当我尝试交换它周围的位置和 ID 顺序时,然后显示值,然后记录城市.

But when I tried swapping the Location and ID order around it then displays the values and then logs the cities.

此外,这只是一个问题,因为当它们是本地表时,我将这些表链接到 SQL,它工作正常.

Also this is only an issue since I linked the tables to SQL when they were local tables it worked fine.

我一定在源查询中缺少某种搜索字段,有人可以帮我吗

I must be missing some sort of search field in the source query, can anyone help me please

谢谢丹

推荐答案

我设法解决了它,我不得不将 ID 从等式中完全去掉,然后添加到我的行源中的额外位置列中

I managed to solve it, I had to take ID out of the equation completely and then add into extra location columns in my row source

结果是这样的:

SELECT Location.Location, Location.Location, Location.Location FROM Location ORDER BY Location.Location;

SELECT Location.Location, Location.Location, Location.Location FROM Location ORDER BY Location.Location;

老实说,我偶然发现了这个并且它有效.所以这对我有用!

To be honest, I stumbled across this and it works. So that will do for me!

这篇关于Access 2007 Combobox 显示表格中的错误结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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