Front Office Football Central  

Go Back   Front Office Football Central > Archives > FOFC Archive
Register FAQ Members List Calendar Mark Forums Read Statistics

Reply
 
Thread Tools
Old 08-19-2008, 07:56 AM   #1
gottimd
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

gottimd is offline   Reply With Quote
Old 08-19-2008, 10:49 AM   #2
Antmeister
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
Antmeister is offline   Reply With Quote
Old 08-20-2008, 06:26 AM   #3
gottimd
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
gottimd is offline   Reply With Quote
Old 08-20-2008, 06:56 AM   #4
henry296
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
henry296 is offline   Reply With Quote
Old 08-20-2008, 07:00 AM   #5
gottimd
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
gottimd is offline   Reply With Quote
Old 08-21-2008, 11:40 AM   #6
gottimd
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:
SELECT `Player Historical`.FirstName, `Player Historical`.LastName, Sum(`Player Game Stats`.TDPasses) AS 'Sum of TDPasses' FROM `C:\NAFL Archive\Programs\NAFLDB\NAFLDB`.`Player Game Stats` `Player Game Stats`, `C:\NAFL Archive\Programs\NAFLDB\NAFLDB`.`Player Historical` `Player Historical` WHERE `Player Game Stats`.PlayerID = `Player Historical`.PlayerID AND ((`Player Game Stats`.Week<23))

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.
gottimd is offline   Reply With Quote
Old 08-21-2008, 11:59 AM   #7
henry296
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
henry296 is offline   Reply With Quote
Old 08-21-2008, 12:49 PM   #8
gottimd
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:
SELECT TOP 25 `Player Historical`.FirstName, `Player Historical`.LastName, Sum(`Player Game Stats`.TDPasses) AS 'Sum of TDPasses'
FROM `C:\NAFL Archive\Programs\NAFLDB\NAFLDB`.`Player Game Stats` `Player Game Stats`, `C:\NAFL Archive\Programs\NAFLDB\NAFLDB`.`Player Historical` `Player Historical`
WHERE `Player Game Stats`.PlayerID = `Player Historical`.PlayerID AND ((`Player Game Stats`.Week<23))

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
gottimd is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Forum Jump


All times are GMT -5. The time now is 05:05 AM.



Powered by vBulletin Version 3.6.0
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.