08-19-2008, 07:56 AM | #1 | ||
Dearly Missed
(9/25/77-12/23/08) Join Date: Nov 2003
Location: DC Suburbs
|
Access Macro Help
I am trying to write a query to open up a table in Access, clear it, and import new data. I figured out how to import data in the actions menu, but I can't figure out how to clear the table before I import.
Anyone know how to do that in the design view for Microsoft Access Macros?
__________________
NAFL New Orleans Saints GM/Co-Commish MP Career Record: 114-85 NAFL Super Bowl XI Champs In memory of Gavin Anthony: 7/22/08-7/26/08 |
||
08-19-2008, 10:49 AM | #2 |
Pro Starter
Join Date: Dec 2003
Location: At the corner of Beat Street and Electric Avenue
|
If you want to clear a table using a macro, create a new macro, select RunSQL. In the field that reads "SQL Statement", write "DELETE * FROM [Your Table Name]".
__________________
"I'm ready to bury the hatchet, but don't fuck with me" - Schmidty "Box me once, shame on Skydog. Box me twice. Shame on me. Box me 3 times, just fucking ban my ass...." - stevew |
08-20-2008, 06:26 AM | #3 |
Dearly Missed
(9/25/77-12/23/08) Join Date: Nov 2003
Location: DC Suburbs
|
Thanks Ant! That worked.
One last thing, is there a way to disable the "Are you sure you want to delete xxxxxx rows?" so that the macro seemlesly runs the routine without me having to wait around and click yes a bunch of times?
__________________
NAFL New Orleans Saints GM/Co-Commish MP Career Record: 114-85 NAFL Super Bowl XI Champs In memory of Gavin Anthony: 7/22/08-7/26/08 |
08-20-2008, 06:56 AM | #4 |
College Starter
Join Date: Oct 2000
Location: Pittsburgh, PA
|
In your macro using the SetWarnings = No.
Make sure to turn them back on at the end with SetWarnings = Yes
__________________
"It's a great day for hockey" - "Badger" Bob Johnson |
08-20-2008, 07:00 AM | #5 |
Dearly Missed
(9/25/77-12/23/08) Join Date: Nov 2003
Location: DC Suburbs
|
Thanks Henry, that worked!
__________________
NAFL New Orleans Saints GM/Co-Commish MP Career Record: 114-85 NAFL Super Bowl XI Champs In memory of Gavin Anthony: 7/22/08-7/26/08 |
08-21-2008, 11:40 AM | #6 |
Dearly Missed
(9/25/77-12/23/08) Join Date: Nov 2003
Location: DC Suburbs
|
Quick additional question, in Microsoft Query, how do I get it to show only the Top 25 records? Do I write it in the SQL statement or is there somewhere this can be defined?
Code:
When I run the query it gives me too many results, and I just want it to return in excel the top 25.
__________________
NAFL New Orleans Saints GM/Co-Commish MP Career Record: 114-85 NAFL Super Bowl XI Champs In memory of Gavin Anthony: 7/22/08-7/26/08 Last edited by gottimd : 08-21-2008 at 11:40 AM. |
08-21-2008, 11:59 AM | #7 |
College Starter
Join Date: Oct 2000
Location: Pittsburgh, PA
|
You need to Use the TOP command right after Select. So Select Top 25 'Player...
__________________
"It's a great day for hockey" - "Badger" Bob Johnson |
08-21-2008, 12:49 PM | #8 | |
Dearly Missed
(9/25/77-12/23/08) Join Date: Nov 2003
Location: DC Suburbs
|
Thanks!
THe last problem I am having is combining the First and Last name. Right now, when I run my query: Quote:
So in excel this now returns the First Name in one column (A), the Last Name comes through in the second column (B) and the stat comes in Column C. Is there a way to have the First and Last name combined? I know how to do it in Access but I can't seem to get it to work in Microsoft Query.
__________________
NAFL New Orleans Saints GM/Co-Commish MP Career Record: 114-85 NAFL Super Bowl XI Champs In memory of Gavin Anthony: 7/22/08-7/26/08 |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
|
|