Active Database

  • Thread starter Thread starter Nedan Nedzatra
  • Start date Start date
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?
 
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?
 
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:
 
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?
 
Back
Top