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!

UserForm Object's Value To Feed Back to Excel (and/or Access)

Status
Not open for further replies.

dddivers

Instructor
Dec 4, 2001
30
US

Hi - a user in another forum suggested I post this question here (even though it mostly involves Excel, it also involves Access).

Here goes: I created a UserForm in Excel VBA (version 2003) that has Checkboxes folks can click to make particular choices. I have coded the checkboxes to feed Textboxes (which are also located on the UserForm)....the purpose of the Textboxes is to show the added (or subtracted) value when a user clicks a particular Checkbox (to show grand totals to keep track of number of checkbox items selected).

What I want is for TextBox3's calculated value (which is the grand total) to immediately feed back to a cell in an Excel worksheet (being used as a database to collect data). This needs to happen before the user closes the UserForm.

Also, would love to know how to take that same Excel UserForm textbox value and have it feed back to a table in Access if anyone knows how to do that.

I've exhausted my brain and other resources trying to figure this out on my own. Hope someone out there can help. Thank you!
 
Hi

I haven't done spefically what you are describing in Excel, but you will need to have an onchange event on each textbox that calls a function like doCalc(). doCalc() would add all the values from the texboxes and then write the value to the cell in excel. Using something similar to Cells(1, 1).Text = myString.

In order to use Access from Excel, then you will need to add a reference to Microsoft Access. Then use OLE Automation to control Access. There is loads of help on for doing that ;)

Good luck!
Rob
 
For the Access stuff you may aloso consider using Recordset (DAO or ADO).

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 

Hi - what I know about coding is pretty much self-taught (I claw my way to hammer out solutions), and although conceptually I understand what both of you are suggesting, I think implementation of those concepts is outside of my modest coding skill set. I did play around with the using Recordset as well as OnChange events but didn't get very far.

BUT, I thank you both very much for your suggestions.

I love the people out here in Tek-Tips world. Just wonderful. Take care.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top