问题描述
在使用MS Access中的VBA在SQL语句中容纳撇号时,我需要一些帮助.请帮忙.
我需要做些什么来防止它挂在撇号上?撇号需要在以下位置接受:
<br />"AND [JOB_FUNCTION]=''" & UCase(rstInputFile![JOB_FUNCTION]) & "''" <br />
[confused] [confused] [confused]
I need some assistance in accommodating an apostrophe in an SQL statement using VBA in MS Access. Please help.<br />strSQLHyperion = "SELECT [COUNTRY], [TYPE], [BUSINESS_UNIT], " & _<br /> "[ALT_GROUPING], [PERSONNEL_AREA], [L_R_G], [REGION], [JOB_FUNCTION], " & _<br /> "[PRIMARY_KEY] FROM [TBLHYPERION] " & _<br /> "WHERE [COUNTRY]=''" & UCase(rstInputFile![COUNTRY]) & "'' " & _<br /> "AND [TYPE]=''" & UCase(rstInputFile![Type]) & "'' " & _<br /> "AND [BUSINESS_UNIT]=''" & UCase(rstInputFile![BUSINESS_UNIT]) & "'' " & _<br /> "AND [ALT_GROUPING]=''" & UCase(rstInputFile![ALT_GROUPING]) & "'' " & _<br /> "AND [PERSONNEL_AREA]=''" & UCase(rstInputFile![PERSONNEL_AREA]) & "'' " & _<br /> "AND [L_R_G]=''" & UCase(rstInputFile![L_R_G]) & "'' " & _<br /> "AND [REGION]=''" & UCase(rstInputFile![REGION]) & "'' " & _<br /> "AND [JOB_FUNCTION]=''" & UCase(rstInputFile![JOB_FUNCTION]) & "''"<br />
What do I need to do to prevent it from hanging up on the apostrophe? The apostrophe needs to be accepted in: <br />"AND [JOB_FUNCTION]=''" & UCase(rstInputFile![JOB_FUNCTION]) & "''" <br />
[confused][confused][confused]
推荐答案
这篇关于在SQL中容纳撇号...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!