在查询中使用替换 [英] Using Replace in query

查看:65
本文介绍了在查询中使用替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好


我正在使用Access(可能是2000或更高版本。没有制作)数据库。


我在网站上有一个搜索框,访问者可以搜索商品编号(tblItem> ItemCD)。


如果我使用的话,一切都很好

Hello

I''m using an Access (could be 2000 or higher. Didn''t make it) database.

I have a search box on a website where visitors can search for item numbers (tblItem > ItemCD).

Everything is fine if I use

展开 | 选择 | < span class =codeLinkonclick =WordWrap(this);> Wrap | 行号

推荐答案

所以,如果我理解这一点,你想输入''cdf12r''并获得匹配''cdf 12r''和''cdf 12 r''对吗?我想我们需要引进访问专家,我会请某人加入。


Jared
So if I understand this right, you want to type in ''cdf12r'' and get matches ''cdf 12r'' and ''cdf 12 r'' right? I think we will need to bring in an access expert, I''ll ask someone to join.

Jared


正好是Jared。我想输入''sdef''或's d f'',我可以在这里取消空格。但我需要与''sd ef''或其他匹配。所以我想删除两者中的空格,它应该工作,但查询中的替换不起作用。 thx求助。

Flokke
exactly Jared. I want to type in ''sdef'' or ''s d e f'' where i can get the spaces off. but i need to have a match with '' sd ef'' or other. So I thought to remove the spaces in both and it should work, but the replace in the query doesnt work. thx for your help.
Flokke


我只能通过说如果在Access中运行你的SQL会有用,我就可以做出贡献。我没有经验使用Access以外的Access查询我很害怕。我是Jared提到的Access专家之一。


可能重要的一件事是Access本身使用DAO,而不是ADODB。我希望只有DAO记录集处理支持使用更标准的VBA类型函数调用(例如 Replace())。


无论你最终使用什么,函数调用的代码需要将参数ItemCD更改为[ItemCD]。很明显,这不是你问题的原因,但如果没有修复,它将成为另一个原因; - )
I can only contribute to this by saying that your SQL would work if run within Access. I have no experience using Access queries from outside of Access I''m afraid. I''m one of the Access experts Jared referred to.

One thing which may be important is that Access uses DAO natively, rather than ADODB. I would expect only DAO recordset processing supports using the more standard VBA type function calls (such as Replace()).

Whatever you end up using though, your code for the function call needs the parameter ''ItemCD'' to be changed to [ItemCD]. Clearly this is not the cause of your problem, but it will be the cause of another if not fixed ;-)


这篇关于在查询中使用替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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