MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Mar 24th, 2002, 02:11 PM   #1
webking
New Member
 
Join Date: Mar 2002
Posts: 21
Default

I have a sheet in excel on which i do entries on daily basis and a new sheet comes in act each day.
Now i want to store the daily report data frome excel to access for making weekly & monthly reports.
Please guide me how i can do this. Like if i want that from cell A1,A2,A3 data on daily basis goes to access and store under the heading of Expenses how i can do that.
webking is offline   Reply With Quote
Old Mar 24th, 2002, 03:02 PM   #2
Ziggy
Board Regular
 
Join Date: Feb 2002
Location: Ontario, Canada
Posts: 326
Default

Import your spreadsheet to Access to create a new table. Set your primary key as date or as a autonumber ID.

now each day just run a import macro (from access) The data should continue to add to the table with out overwriting.

Ziggy
Ziggy is offline   Reply With Quote
Old Mar 24th, 2002, 03:36 PM   #3
Yogi Anand
MrExcel MVP
 
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
Default

Hi webking and Ziggy:
Would there be any merit in linking the ACCESS Table to a Worksheet or a certain range in the Worksheet -- just a thought!
This might make sense because it appears you still want to do your processing in EXCEL and you want to use ACCESS as a front for reporting.
__________________
Regards!

Yogi Anand, D.Eng, P.E.
Energy Efficient Building Network LLC
www.energyefficientbuild.com
Yogi Anand is offline   Reply With Quote
Old Mar 24th, 2002, 08:13 PM   #4
Ziggy
Board Regular
 
Join Date: Feb 2002
Location: Ontario, Canada
Posts: 326
Default

I thought about that also, but I figured collecting the data in access via the import would allow him to simply overwrite the Excel file each day as it sounds like this is a daily process.

If the table is linked then there has to be a way to append the data so it is not lost when the file is overwriten. Possibly a Append Query?

If archiving the data is not required, then I think the link would be the best option.

Ziggy
Ziggy is offline   Reply With Quote
Old Mar 25th, 2002, 12:48 AM   #5
Tommy Bak
Board Regular
 
Join Date: Feb 2002
Location: Guderup, Denmark
Posts: 287
Default

Hi
I hope this example can help you getting startet.Sub AddRecordToAccess()
Dim db As Database
Dim rs As Recordset
Set db = OpenDatabase("C:Test.mdb")
Set rs = db.OpenRecordset(Name:="Test", Type:=dbOpenDynaset)'Tablename
With rs
.AddNew
.Fields("Name").Value = Range("A1")
.Fields("Age").Value = Range("A2")
.Fields("Phone").value=Range("A3")
.Update
End With
rs.Close
db.Close
Set rs = Nothing
End Sub

regards Tommy


Tommy Bak is offline   Reply With Quote
Old Mar 25th, 2002, 05:58 AM   #6
webking
New Member
 
Join Date: Mar 2002
Posts: 21
Default

Thankyou all .

Please explain this code like how to use it according to my needs .
webking is offline   Reply With Quote
Old Mar 25th, 2002, 07:14 AM   #7
justa
New Member
 
Join Date: Mar 2002
Posts: 1
Default

You can actually link to an Excel file from Access. It depends how you are using the Excel entry sheet. If you continue to add daily activity on the next available row so that one sheet has ALL data, then this may work for you.

1. The Excel file must have column headings starting on row 1, and all cell formats must be the same (i.e. don't enter numbers and characters in the same field)

2. From Access select the Tables Tab, New, Link Table, and change the file type to Excel.

3. Now you can create reports using the linked sheet as your data source.


Did I read your message correctly, that you are using data from ACT? If so, you may be able to save as a text file and import directly to Access.
justa is offline   Reply With Quote
Old Mar 25th, 2002, 08:09 AM   #8
Tommy Bak
Board Regular
 
Join Date: Feb 2002
Location: Guderup, Denmark
Posts: 287
Default

Hey
Open your worksheet, press Alt-F11.
In the VBA editor insert a new module and copy this code into that.
Put in your actual database name where it say C:testbasebase.
Put in your actual table-name where it says Testtable.
In the menu "Tools / references" checkmark "Microsoft DAO 3,6 object

library".
Alt-F11 to get back to the worksheet.

Now you're ready to run the macro from "Tools/macro"
You can also assign a button to this macro.
Be aware that the macro does not check the database to see if todays

record is allready put in. You can, by mistake, use the macro more than

once per day.


Sub AddRecordToAccess()
Dim db As Database
Dim rs As Recordset

'opens a link to the msaccess database named testdatabase
Set db = OpenDatabase("C:Testdatabase.mdb")

'opens a link to the table named testtable in the database Testdatabase
Set rs = db.OpenRecordset(Name:="Testtable", Type:=dbOpenDynaset)

'Put A1, A2 and A3 into 3 new databaserecords in fieldname "Expenses"
With rs
for x = 1 to 3
.AddNew
.Fields("Expenses").Value = Range("A" & x).value
.Update
Next
End With

' close table
rs.Close

'close database
db.Close

'Clean up
Set rs = Nothing
End Sub



regards Tommy
Tommy Bak is offline   Reply With Quote
Old Mar 25th, 2002, 04:17 PM   #9
webking
New Member
 
Join Date: Mar 2002
Posts: 21
Default

Tommy, thanks a lot for your help. i really appricetae waht u have done for me.
Kindly guide me how i can set excel to search a praticular thing.

can i email you.
talentshow@yahoo.com
webking is offline   Reply With Quote
Old Mar 26th, 2002, 12:27 AM   #10
Tommy Bak
Board Regular
 
Join Date: Feb 2002
Location: Guderup, Denmark
Posts: 287
Default

Yes.
Tommybak@netscape.net
Regards Tommy
Tommy Bak is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On

Forum Jump


All times are GMT -4. The time now is 08:54 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes