browse: forums | FAQ
Connecting Tech Pros Worldwide

Hey there! Do you need Microsoft Access / VBA help?

Get answers from our community of Microsoft Access / VBA experts on BYTES! It's free.

Replace function in Access

seanmatthewwalsh@hotmail.com
Guest
 
Posts: n/a
#1: Jun 27 '08
Hi

I have a website that uses an Access 2003 database. I have controls on
my pages that are bound to SqlDataSources that pull data from this
database. In a couple of them, I need to use the replace function to
replace some text in the results. Access' REPLACE function is only
available if executed within the environment, as it's a VBA function,
not a SQL function. So how can I implement this is the EASIEST
possible way? I don't to rewrite all my pages to first pull the data
into a DataSet and then do the replace, as I'll soon be back on SQL
Server, and can use the Replace function there.

Can I either do some sort of post-result transformation on the page
side, or how do I set up a macro / function in Access that the query
will be able to see? I created a MYREPLACE function in a Module, which
works fine if I run it in Access, but I still get the web error:
System.Data.OleDb.OleDbException: Undefined function 'MYREPLACE' in
expression

thanks
Sean



Tom van Stiphout
Guest
 
Posts: n/a
#2: Jun 27 '08

re: Replace function in Access


On Tue, 20 May 2008 02:09:32 -0700 (PDT), seanmatthewwalsh@hotmail.com
wrote:

MYREPLACE is a Vba function just like REPLACE, and you already stated
they cannot be used.
You'll have to do this on the DotNet side, or postpone the work until
you're back on SQL Server.

-Tom.

Quote:
>Hi
>
>I have a website that uses an Access 2003 database. I have controls on
>my pages that are bound to SqlDataSources that pull data from this
>database. In a couple of them, I need to use the replace function to
>replace some text in the results. Access' REPLACE function is only
>available if executed within the environment, as it's a VBA function,
>not a SQL function. So how can I implement this is the EASIEST
>possible way? I don't to rewrite all my pages to first pull the data
>into a DataSet and then do the replace, as I'll soon be back on SQL
>Server, and can use the Replace function there.
>
>Can I either do some sort of post-result transformation on the page
>side, or how do I set up a macro / function in Access that the query
>will be able to see? I created a MYREPLACE function in a Module, which
>works fine if I run it in Access, but I still get the web error:
>System.Data.OleDb.OleDbException: Undefined function 'MYREPLACE' in
>expression
>
>thanks
>Sean
Closed Thread