.sql replace for more than one field (1 Viewer)

dj59

Registered User.
Local time
Yesterday, 20:05
Joined
Jul 27, 2012
Messages
70
I'd like to use the follwong code to replace more than one field in the query. Can you tell me how that is done?

Code:
Dim qdf As DAO.QueryDef
Dim qdfOLD As String
Set qdf = CurrentDb.QueryDefs("qry_55")
With qdf
    qdfOLD = .SQL
 [B]   .SQL = Replace(.SQL, "c.cnty_cd = '01'", "c.cnty_cd='11'")[/B]
    ' Code to do stuff with SQL-string/query
    .SQL = qdfOLD ' Reset SQL to old setting
End With
Set qdf = Nothing
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 18:05
Joined
Aug 30, 2003
Messages
36,118
You can add another line with a second Replace() function.
 

dj59

Registered User.
Local time
Yesterday, 20:05
Joined
Jul 27, 2012
Messages
70
Yes. that worked well. Thanks.
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 18:05
Joined
Aug 30, 2003
Messages
36,118
No problem.
 

Users who are viewing this thread

Top Bottom