Delete Table in Another Database

K

Kou Vang

I am trying to delete a table from another database before I transfer new
data into it from the current DB. I tried to run some SQL that I picked up
online but it didn't work. Any ideas on how to proceed with this?

Option Explicit

strSQL = "Delete * in H:\LakeStorageDB.mdb from LakeInfoObserv"

docmd.runsql strsql

I get a syntax error, missing operand?

Thanks,

Kou
 
D

Douglas J. Steele

strSQL = "Delete * from LakeInfoObserv in H:\LakeStorageDB.mdb"

or

strSQL = "Delete * from [;database=H:\LakeStorageDB.mdb].LakeInfoObserv"
 
K

Kou Vang

I tried the first change you gave and got the dreaded "Runtime Error 3131"
FROM syntax error! I tried putting my table in brackets, same error. I
tried the second one and it did work. Strange. Thanks Doug!

Kou


Douglas J. Steele said:
strSQL = "Delete * from LakeInfoObserv in H:\LakeStorageDB.mdb"

or

strSQL = "Delete * from [;database=H:\LakeStorageDB.mdb].LakeInfoObserv"

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kou Vang said:
I am trying to delete a table from another database before I transfer new
data into it from the current DB. I tried to run some SQL that I picked
up
online but it didn't work. Any ideas on how to proceed with this?

Option Explicit

strSQL = "Delete * in H:\LakeStorageDB.mdb from LakeInfoObserv"

docmd.runsql strsql

I get a syntax error, missing operand?

Thanks,

Kou
 
K

Kou Vang

Okay...So I tried the first one and it didn't work. I tried the second one
and it did, but it also erased everything that was in a table I also have
called LakeInfoObserv. Why did it erase both of them?

Kou


Douglas J. Steele said:
strSQL = "Delete * from LakeInfoObserv in H:\LakeStorageDB.mdb"

or

strSQL = "Delete * from [;database=H:\LakeStorageDB.mdb].LakeInfoObserv"

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kou Vang said:
I am trying to delete a table from another database before I transfer new
data into it from the current DB. I tried to run some SQL that I picked
up
online but it didn't work. Any ideas on how to proceed with this?

Option Explicit

strSQL = "Delete * in H:\LakeStorageDB.mdb from LakeInfoObserv"

docmd.runsql strsql

I get a syntax error, missing operand?

Thanks,

Kou
 
K

Kou Vang

Nevermind...I have the destination table linked to the current, so of course
they would be both deleted if that's the case. It's always the small things.

Kou


Kou Vang said:
Okay...So I tried the first one and it didn't work. I tried the second one
and it did, but it also erased everything that was in a table I also have
called LakeInfoObserv. Why did it erase both of them?

Kou


Douglas J. Steele said:
strSQL = "Delete * from LakeInfoObserv in H:\LakeStorageDB.mdb"

or

strSQL = "Delete * from [;database=H:\LakeStorageDB.mdb].LakeInfoObserv"

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kou Vang said:
I am trying to delete a table from another database before I transfer new
data into it from the current DB. I tried to run some SQL that I picked
up
online but it didn't work. Any ideas on how to proceed with this?

Option Explicit

strSQL = "Delete * in H:\LakeStorageDB.mdb from LakeInfoObserv"

docmd.runsql strsql

I get a syntax error, missing operand?

Thanks,

Kou
 

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