Inner join on Memo fields (1 Viewer)

SkyCraw

Registered User.
Local time
Today, 11:59
Joined
Oct 9, 2013
Messages
100
Good morning everyone!

I've got an issue pertaining to inner joins within an update query. This query will not run now (giving the expected "must use an updateable query" error) due to two fields involved in one of the inner joins are now both memo fields.

Is there any way (and I assume there must be in vba) to recreate this query so it will run with inner joins involving memo fields?

If not, is there a way in vba to do a find and replace within a table? For example, replace the "A" in "A-001" with "B"?

If either is possible, let me know! :)
 

pr2-eugin

Super Moderator
Local time
Today, 15:59
Joined
Nov 30, 2011
Messages
8,494
Find and Replace should not be a problem. Give some example data (actual data), because the one you have would be way too simple.
Code:
Replace("A-001", "A", "B")
 

SkyCraw

Registered User.
Local time
Today, 11:59
Joined
Oct 9, 2013
Messages
100
In that case, what I'll be replacing is our company's model numbers based on a value in a control box so, from a data perspective, it would look more like the following:

Code:
Replace("PD15-001", "PD15", "PD12")

However, from a vba perspective, I was intending on doing something like this:

Code:
Dim OMN, NMN as string

OMN = [Forms]![thisform]![old model no]
NMN = [Forms]![thisform]![new model no]

DoCmd.OpenTable "thistable"

Replace([Option No], OMN, NMN)

DoCmd.Close acTable, "thistable"
 

pr2-eugin

Super Moderator
Local time
Today, 15:59
Joined
Nov 30, 2011
Messages
8,494
No you would be doing something like.
Code:
CurrentDB.Execute "UPDATE thistable SET thistable.[Option No] = Replace(thistable.[Option No], " & _
                                                                        [Forms]![thisform]![old model no] & ", " & _
                                                                        [Forms]![thisform]![new model no] & ");"
 

SkyCraw

Registered User.
Local time
Today, 11:59
Joined
Oct 9, 2013
Messages
100
For some reason, it was having issues with parameters when executing (even after checking all the references and spelling :p), but I was able to mimic the SQL execution within an actual query and made it run with no hiccups.

Regardless, thanks for all the help pr2! :D
 

pr2-eugin

Super Moderator
Local time
Today, 15:59
Joined
Nov 30, 2011
Messages
8,494
Not sure why there should be a problem. Glad you have it sorted though. Good Luck.
 

Users who are viewing this thread

Top Bottom