Advertisement

05.20.2008 at 07:30AM PDT, ID: 23417281
[x]
Attachment Details

Undefined function 'Replace' in expression.

Asked by Chuckbuchan in Databases Miscellaneous, VB Database Programming

Tags: MS, Access / VisualBasic.NET, 2008

I have attached a code sample. One I execute the query and in the other I pass it through as an OLEDBCommand. Both ways an error claims that "Replace" is not a function. I am using Access 2007 and the OLEDB connection. Any way to work around this?


Thanks.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
Dim FindOIFields As New OleDbCommand("Execute LOCATE_OI", aConn)
        'Dim FindOIFields As New OleDbCommand("INSERT INTO PHONE_LOCATOR ( FILENO, PhoneNum1, PhoneNum2, PhoneNum3, PhoneNum4 ) " + _
        '                                    "SELECT dbo_RECENT_OI_OUTPUT.SourceID, Sum(IIf(IsNull([dbo_DEBTOR]![PHONE]),0,IIf([dbo_RECENT_OI_OUTPUT]![PhoneNum]=(Replace(Replace([dbo_DEBTOR]![PHONE],'/',''),'-','')),1,0))) AS PhoneNum1, Sum(IIf(IsNull([dbo_DEBTOR]![PHONE2]),0,IIf([dbo_RECENT_OI_OUTPUT]![PhoneNum]=Replace(Replace([dbo_DEBTOR]![PHONE2],'/',''),'-',''),1,0))) AS PhoneNum2, Sum(IIf([dbo_AlternatePhoneTable]![ALT_PHONE1]=Null,0,IIf([dbo_RECENT_OI_OUTPUT]![PhoneNum]=[dbo_AlternatePhoneTable]![ALT_PHONE1],1,0))) AS PhoneNum3, Sum(IIf([dbo_AlternatePhoneTable]![ALT_PHONE2]=Null,0,IIf([dbo_RECENT_OI_OUTPUT]![PhoneNum]=[dbo_AlternatePhoneTable]![ALT_PHONE2],1,0))) AS PhoneNum4 " + _
        '                                    "FROM (dbo_RECENT_OI_OUTPUT INNER JOIN dbo_DEBTOR ON dbo_RECENT_OI_OUTPUT.SourceID = dbo_DEBTOR.FILENO) INNER JOIN dbo_AlternatePhoneTable ON dbo_RECENT_OI_OUTPUT.SourceID = dbo_AlternatePhoneTable.FILENO " + _
        '                                    "GROUP BY dbo_RECENT_OI_OUTPUT.SourceID " + _
        '                                    "ORDER BY dbo_RECENT_OI_OUTPUT.SourceID", aConn)
        FindOIFields.CommandTimeout = 60000
        FindOIFields.ExecuteNonQuery()
[+][-]05.20.2008 at 08:23AM PDT, ID: 21607042

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.20.2008 at 09:07AM PDT, ID: 21607570

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.20.2008 at 10:15AM PDT, ID: 21608212

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.20.2008 at 10:54AM PDT, ID: 21608528

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.20.2008 at 11:15AM PDT, ID: 21608724

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.20.2008 at 11:44AM PDT, ID: 21608986

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Databases Miscellaneous, VB Database Programming
Tags: MS, Access / VisualBasic.NET, 2008
Sign Up Now!
Solution Provided By: Arthur_Wood
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.20.2008 at 03:19PM PDT, ID: 21610857

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628