Active Database

N

Nedan Nedzatra

Hia!

Good Morning Friends!

I have checked on appending fields to tables on databases that are not
active but how to do it for the ones that are already open?
 
N

Nedan Nedzatra

Hia!

Thanks.

I did it as shown below;

Sub AppendField()

DoCmd.RunSQL " ALTER TABLE [NewTable]ADD column_nam char"

End Sub

So I am going through SQL to do it. Is it possible to do it through VBA
only? Is there something in Access VBA like ActiveDocument or ActiveWorkbook
in Word and Excel VBA?
 
J

Jack Leach

Read up on the TableDefs collection. This model should provide the means.
Although, I would think SQL an easier solution.

hth
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



Nedan Nedzatra said:
Hia!

Thanks.

I did it as shown below;

Sub AppendField()

DoCmd.RunSQL " ALTER TABLE [NewTable]ADD column_nam char"

End Sub

So I am going through SQL to do it. Is it possible to do it through VBA
only? Is there something in Access VBA like ActiveDocument or ActiveWorkbook
in Word and Excel VBA?


BruceS said:
 
N

Nedan Nedzatra

Hia!

Thanks.

I have checked on Tabledefs on closed databases. It works. The problem is
referring to an open database; error occurs saying 'opening prohibited by
admin' because the file is open.

I thought there should be a way to refer to an open database!

Jack Leach said:
Read up on the TableDefs collection. This model should provide the means.
Although, I would think SQL an easier solution.

hth
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



Nedan Nedzatra said:
Hia!

Thanks.

I did it as shown below;

Sub AppendField()

DoCmd.RunSQL " ALTER TABLE [NewTable]ADD column_nam char"

End Sub

So I am going through SQL to do it. Is it possible to do it through VBA
only? Is there something in Access VBA like ActiveDocument or ActiveWorkbook
in Word and Excel VBA?


BruceS said:
Nedan,

See http://www.w3schools.com/SQl/sql_alter.asp

Best,
Bruce

:

Hia!

Good Morning Friends!

I have checked on appending fields to tables on databases that are not
active but how to do it for the ones that are already open?
 

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