PC Review


Reply
Thread Tools Rate Thread

Delete error table using IF in macro

 
 
Song Su
Guest
Posts: n/a
 
      9th Dec 2009
When I import using macro, error tables created for each run. They are

sapbud_ImportErrors
sapbud_ImportErrors1 etc

How to use IF statement in macro? If these error tables exist, delete.

Thanks.

Song
 
Reply With Quote
 
 
 
 
Steve Schapel
Guest
Posts: n/a
 
      9th Dec 2009
Song,

I am not sure whether there is a more sophisticated way to do this. But I
have handled this problem by using an OpenQuery action in the macro, to run
a Make-Table query that creates such a table, in your case
sapbud_ImportErrors. If the table does not already exist, it makes one. If
the table does already exist, it overwrites the existing one. Either way,
you then avoid the error that you would otherwise get with the DeleteObject
action if there is no such table.

--
Steve Schapel, Microsoft Access MVP


"Song Su" <(E-Mail Removed)> wrote in message
news:A8EAAC43-A994-48C4-AFDD-(E-Mail Removed)...
> When I import using macro, error tables created for each run. They are
>
> sapbud_ImportErrors
> sapbud_ImportErrors1 etc
>
> How to use IF statement in macro? If these error tables exist, delete.
>
> Thanks.
>
> Song


 
Reply With Quote
 
Song Su
Guest
Posts: n/a
 
      10th Dec 2009
Make sense. I'll try that. Thank you.

"Steve Schapel" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Song,
>
> I am not sure whether there is a more sophisticated way to do this. But I
> have handled this problem by using an OpenQuery action in the macro, to
> run a Make-Table query that creates such a table, in your case
> sapbud_ImportErrors. If the table does not already exist, it makes one.
> If the table does already exist, it overwrites the existing one. Either
> way, you then avoid the error that you would otherwise get with the
> DeleteObject action if there is no such table.
>
> --
> Steve Schapel, Microsoft Access MVP
>
>
> "Song Su" <(E-Mail Removed)> wrote in message
> news:A8EAAC43-A994-48C4-AFDD-(E-Mail Removed)...
>> When I import using macro, error tables created for each run. They are
>>
>> sapbud_ImportErrors
>> sapbud_ImportErrors1 etc
>>
>> How to use IF statement in macro? If these error tables exist, delete.
>>
>> Thanks.
>>
>> Song

>

 
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
Delete a Table via Macro nc Microsoft Access VBA Modules 4 2nd Oct 2009 03:45 PM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Microsoft Excel Worksheet Functions 0 3rd May 2008 01:04 AM
macro to delete a row from a table? =?Utf-8?B?a3ZhbmlzaA==?= Microsoft Access Macros 2 23rd Apr 2005 08:38 PM
Macro to delete Table - table lock message by Access pele Microsoft Access Macros 2 20th Apr 2005 10:16 PM
Delete Table using macro Alison Microsoft Access Macros 3 29th Jul 2003 03:42 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:30 PM.