PC Review


Reply
Thread Tools Rate Thread

Delete Table in Another Database

 
 
Kou Vang
Guest
Posts: n/a
 
      28th Jul 2008
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
 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      28th Jul 2008
strSQL = "Delete * from LakeInfoObserv in H:\LakeStorageDB.mdb"

or

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

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Kou Vang" <(E-Mail Removed)> wrote in message
news:9740FDF4-862A-4F8C-AAEC-(E-Mail Removed)...
>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



 
Reply With Quote
 
Kou Vang
Guest
Posts: n/a
 
      28th Jul 2008
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" wrote:

> strSQL = "Delete * from LakeInfoObserv in H:\LakeStorageDB.mdb"
>
> or
>
> strSQL = "Delete * from [;database=H:\LakeStorageDB.mdb].LakeInfoObserv"
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "Kou Vang" <(E-Mail Removed)> wrote in message
> news:9740FDF4-862A-4F8C-AAEC-(E-Mail Removed)...
> >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

>
>
>

 
Reply With Quote
 
Kou Vang
Guest
Posts: n/a
 
      28th Jul 2008
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" wrote:

> strSQL = "Delete * from LakeInfoObserv in H:\LakeStorageDB.mdb"
>
> or
>
> strSQL = "Delete * from [;database=H:\LakeStorageDB.mdb].LakeInfoObserv"
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "Kou Vang" <(E-Mail Removed)> wrote in message
> news:9740FDF4-862A-4F8C-AAEC-(E-Mail Removed)...
> >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

>
>
>

 
Reply With Quote
 
Kou Vang
Guest
Posts: n/a
 
      28th Jul 2008
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" wrote:

> 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" wrote:
>
> > strSQL = "Delete * from LakeInfoObserv in H:\LakeStorageDB.mdb"
> >
> > or
> >
> > strSQL = "Delete * from [;database=H:\LakeStorageDB.mdb].LakeInfoObserv"
> >
> > --
> > Doug Steele, Microsoft Access MVP
> > http://I.Am/DougSteele
> > (no e-mails, please!)
> >
> >
> > "Kou Vang" <(E-Mail Removed)> wrote in message
> > news:9740FDF4-862A-4F8C-AAEC-(E-Mail Removed)...
> > >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

> >
> >
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I delete a table in another database using VBA? L.A. Lawyer Microsoft Access Form Coding 1 21st Feb 2009 11:19 PM
Delete a table in a different database =?Utf-8?B?U3RldmU=?= Microsoft Access External Data 1 14th Jul 2006 08:56 PM
Delete a Table not in Current Database =?Utf-8?B?Um9zcw==?= Microsoft Excel Misc 3 12th May 2005 02:51 PM
Delete a table in another database =?Utf-8?B?U0hJUFA=?= Microsoft Access VBA Modules 2 4th Nov 2004 06:13 PM
Delete Table in BE Database Anand Microsoft Access Form Coding 4 7th Nov 2003 03:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:08 PM.