Reproducable bug with Access 2007 runtime: macro, rename table does notwork

  • Thread starter Alain Bourgeois
  • Start date
A

Alain Bourgeois

Dear all,

I have a macro renaming the table X to A.

This macro works fine when access 2K3 is installed.

With run-time 2007 (and perhaps with Access 2007 also), I don't get any
error message and the rename is done. (Run-time allows me to delete and
import objects, but not to rename?)

The table has no relations.

Can someone tell me if there is a patch/workaround for this? Seems to be
to be a (severe) bug.

Regards,
Alain
 
A

Albert D. Kallal

It's pretty hard to debug and figure what the problem is with zero
information here.

I would probably strongly suggest that you rewrite the code using VBA, and
therefore you can then use error trapping to give you a decent error message
as to why this is failing...

Do keep in mind that any code that opens the table, any form that is
attached the table, or any report that is attached to the table (and opened)
will prevent you from renaming the table.

You might also mana mention what the macro code looks like here. Are you
using sql ddl commands, or built in commands that rename?

Some objects can not be flipped into design mode and changed when using
runtime, so, once again more details on what commands are using to
accomplish this renaming will be needed.

I actually wasn't aware that you could rename a table while running code,
and I kind of always assumed that you simply appended the table to another
new name, and then deleted or droped the old table.

Obviously your coding approaches to how your accomplishing this re-name will
affect the solutions and even if in fact access even allows this....
 
A

Alain Bourgeois

I don't know if using vba will solve the problem... as no exception is
raised!

The macro has a single instruction:
Rename, parameters are:
new name
object type (table)
old name

I reproduced the error with a table without any relation and without any
form/query based on it.
The problem is a real bug of the run-time 2007.

As you say:
"Do keep in mind that any code that opens the table, any form that is
attached the table, or any report that is attached to the table (and
opened)
will prevent you from renaming the table."
-> This macro runs ok with access 2003, and is not due to open objects.

Furthermode, run-time 2007 allows me to delete the same table... but not
to rename it to a new name.

As you say:
"I actually wasn't aware that you could rename a table while running
code,
and I kind of always assumed that you simply appended the table to
another
new name, and then deleted or droped the old table."
-> The table I replace with a new one has extra columns so I need to
replace it... (and renaming old one or new one to import old datas). It
works fine with other access run-time versions, why not 2007?
I don't rename modules, just tables...

Regards,
Alain
 
A

Albert D. Kallal

I just tired running a macro in a2007 to rename a table using the rename
command....

it worked just fine.....

I also tried it with the /runtime switch...and it also worked.......
(you can use the /runtime switch to "test" things in a runtime environment
on your machine).

I would suggest you test/try running the sample with a /runtime in a
shortcut.....

It is possible that I *must* test in a true runtime environment to see the
problem, but generally using a shortcut with /runtime should produce same
results....

I would create a test database with one table, one startup form with a
single button that runs the macro code to JUST rename the table...noting
less, nothing more......

The above test type database did rename just fine for me....

(as I type this, I am downloading copy of a2007 runtime to "test" on a
virgin clean machine to "see" if there is some "rare" reason that the
/runtime switch was not a fair test....

At this point....the rename worked fine for me....
 
A

Alain Bourgeois

With (true) run-time (no access installed) it does NOT work. I
reproduced problem with win vista and win xp pro sp 2. All customers
running with run-time reported same problem.
 
A

Alain Bourgeois

For info:

macro converted to vb module:
DoCmd.Rename "xcon2", acTable, "xcon" -> Does NOT work under runtime
(table keeps name XCon, and no exception is raised)

If I rewrite using DAO:
CurrentDb.TableDefs("xcon").Name = "xcon2"
CurrentDb.TableDefs.Refresh
->This works under runtime
 
G

George Nicholson

-> This macro runs ok with access 2003, and is not due to open objects.

2003 Runtime? Working in 2003 Retail doesn't really tell you anything about
the current problem.
 
A

Albert D. Kallal

Alain Bourgeois said:
With (true) run-time (no access installed) it does NOT work. I
reproduced problem with win vista and win xp pro sp 2. All customers
running with run-time reported same problem.

I am able to confirm this behavior and problem.....

In fact, with the "full" version of a2007, if you rename the accdb file to
accdr (runtime mode), then the rename fails (and, even when using VBA with
error handling..NO error is raised).

I not tried the above with office 2007 sp1 installed, so I tray that
latter..

The workaround is rather nasty..as you may have to resort to dao code as you
did.....

I try this again later today with sp1...and I will submit this as a
escalated bug if it fails at that point...

I have to say this is the FIRST time I seen *different* behaviors when using
the /runtime switch. However, it does fail completely with the full version
of access if you rename the extension as a "r" for runtime. So, this "bug"
is NOT limited to the runtime environment only....

Thanks a bunch for persisting on this....you are 100% correct on your
observations...this is a bug (or, a very strange undocumented behavior
that's by design for the runtime environment -- which I don't buy for one
second!!).

I will post my results here again after installing SP1 for office 2007....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top