Delete Table in Another Database

  • Thread starter Thread starter Kou Vang
  • Start date Start date
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
 
strSQL = "Delete * from LakeInfoObserv in H:\LakeStorageDB.mdb"

or

strSQL = "Delete * from [;database=H:\LakeStorageDB.mdb].LakeInfoObserv"
 
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
 
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
 
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
 
Back
Top