通过访问填充组合框 [英] Fill a combobox from access

查看:76
本文介绍了通过访问填充组合框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

首先,对不起我的英语

我想用代码和描述填充访问表中的组合框,但是
代码为10位数字,说明为50

我希望描述从代码的总位数加1
开始
看起来像

Hi to all

First of all sorry for my English

I want to fill a combobox from an access table with code and description but
the code is 10 digits and the Description is 50

I want the description start after the total digits of the code plus 1

Looks like

1          Descr1
12         Descr12
123        Descr123
1234       Descr1234
12345      Descr12345
123456     Descr123456
1234567    Descr1234567
12345678   Descr12345678
123456789  Descr123456789
1234567890 Descr1234567890


这可能吗?
我知道如何从访问权限中填充一个组合,但是我不知道如何从位置11开始进行描述.
感谢和问候.


Is this possible??
I knew how to fill a combo from access but i don’t knew how to make the description start from the position 11
Thanks and regards.

推荐答案

您可以在您的SQL中尝试使用此方法:
You could try this in your SQL:
SELECT LEFT(code & ''           '', 11) as code, description FROM myFile



它在代码末尾连接11个空格,然后获取该字符串的前11个字符.所以基本上这是一个不错的选择.

----已添加----
为此,您需要将组合框上的字体设置为等宽字体 [列表 [



It concats eleven spaces to the end of the code, then grabs the first eleven characters of that string. So basically It''s a pad right.

---- Added ----
For this to work, you''ll need to set the font on your combo box to a monospaced font[^] like Courier New. Here is a list[^] of others.


字母间距(如您所提到的,诸如m和w之类的字母)总是一个问题.

您可以通过两种方式解决此问题-使用Kschuler提到的等宽字体,也可以让comobo框显示多列

在codeproject上有几篇文章显示了这一点

多列组合框 [具有自动完成功能的平面多列组合框 [多列组合框 [
Letter spacing (as you mentioned, letters such as m and w) are always going to be an issue.

You can tackle this in a couple of ways - use a monospaced font as mentioned by Kschuler or you could have your comobo box display multiple columns

There are a few articles on codeproject that show this

Multi Column ComboBox[^]

Flat-MultiColumn Combobox with Autocomplete[^]

Multi-Column ComboBox[^]

Then, you''d just set your column widths and load data in...it would always be aligned correctly.


这篇关于通过访问填充组合框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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