Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Move to Access From Excel- With Option Button????!!!!

Status
Not open for further replies.

MrsTFB

MIS
Oct 3, 2000
307
US
Hey,
I've recieved very much help from this website, thought I would try again.
Here's what I want to do, I have a comprehensive database in Access to keep up with quotes going through the company and their progress. I'm trying to give an option in Excel from an Option Button on a form to go directly to this database.

I've tried a few things, none work.

Please offer any advice you can!

Thanks,

Bsimm

GO TITANS! *:->*
 
I just completed something similar. However, I assigned a macro to a command button and used the following code:

Set db = DBEngine.OpenDatabase("MyDatabase")
Set rs = db.OpenRecordset("MyAccessTable")
rs.AddNew
rs![Accessfield] = Range("RangeonExcelspreadsheet")
rs![AnotherAccessfield] = Range("AnotherRange")
rs.Update
rs.Close
db.Close

Hope this helps!
 
Wallegator,
I must be missing something. I've tried your code above in the code function of a command button on a form in Excel. When I try to run the command, the first line gives me "Object required". What did I miss. I'm thinking that Access must be defined somewhere, what do you think?

Did yours work just as coded above?

I'm new at this coding a little, so you may have to be basic in your explanations.

Thanks so much for your ideas,

Bsimm
::)
 
Right click on your command button and click on Assign macro. Click on the macro name that has the code in it and click on Edit. This will get you back into the code.

From the menu bar, click on Tools-Reference. A window will pop up with a title bar that says "References-VBA Project". The following items need to be checked:

Visual Basic for Applications
Microsoft Excel 9.0 Object Library
Micosoft Data Access Components Installed Version

I think the second one in the list above is giving you the object error. #3 in the list gives you your connection to Access. I had to go to Microsoft's web site and download the Data Access components (#3). If you need to do the same, try the following:

1. Goto 2. Click on Download mcdc 2.5 sp1 (2.51.5303.5)
3. Select mdac 2.5 spi (2.51.5303.5) for x86
4. Click goto Download.
5. Once the download is complete, execute mdac_typ.exe

My e-mail address is dwuescher@aol.com if you have further questions. Be sure to reference tek-tips in your subject or I may not read the e-mail.

Hope you can get this to work for you. Its been a time-saving routine in many of my projects and my clients have been pleased with its functionality.
 
Thanks for your reply, I'll let you know how it comes out!

Bsimm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top