|
-
Feb 27th, 2006, 09:54 AM
#1
Thread Starter
New Member
[RESOLVED] Upsizing from Access 2k3 to SQL, need to change queries and macros programmatically
As you can see from the title I am attempting to upsize an Access 2k3 database to SQL. One of the major tables has a field name that is also a SQL reserved keyword (CAGE). There are a whole lot of Queries and Macros that use this field so I am looking for an easy way to write a macro or function to search through each one and change and instances of CAGE to CAGEcode.
I searched on here and found an example of how to change table data so I am pretty sure what I am trying to accomplish can be done.
I don't want to reference the queries by name so I am assuming I can reference them by an index number and just cycle through.
Any info would be greatly appreciated. Thanks!
dingle
-
Mar 2nd, 2006, 03:10 PM
#2
Addicted Member
Re: Upsizing from Access 2k3 to SQL, need to change queries and macros programmatically
Hello,
I've tried this in a 2k3 access db.
It's with DAO but works like a charm
Code:
Sub test()
Dim tdf As TableDef
Dim fld As dao.Field
For Each tdf In CurrentDb.TableDefs
For Each fld In tdf.Fields
If InStr(1, UCase(fld.Name), "CAGE", vbTextCompare) <> 0 Then
tdf.Fields(fld.Name).Name = "New_" & fld.Name
End If
Next
Next
End Sub
-
Mar 6th, 2006, 03:59 PM
#3
Thread Starter
New Member
Re: Upsizing from Access 2k3 to SQL, need to change queries and macros programmatically
 Originally Posted by Killazzz
Hello,
I've tried this in a 2k3 access db.
It's with DAO but works like a charm
Code:
Sub test()
Dim tdf As TableDef
Dim fld As dao.Field
For Each tdf In CurrentDb.TableDefs
For Each fld In tdf.Fields
If InStr(1, UCase(fld.Name), "CAGE", vbTextCompare) <> 0 Then
tdf.Fields(fld.Name).Name = "New_" & fld.Name
End If
Next
Next
End Sub
That is exaclty what I am trying to do. Thanks for your help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|