i think this is a good question

dhoffman

New Member
Joined
Apr 1, 2002
Messages
29
I have a worksheet where two columns of data come from a database and the other columns are calculations based upon the other columns. There is a drop down box on the sheet that the user uses to select what data is loaded from the database. Basically, based upon what is chosen in the drop down box a query will run that will return an unpredictable number of records. Each record is used to fill out one row of the two columns mentioned above. Now I want the user to be able to easily delete a row/record from the database. I have thought about including a textbox or userform where the user can enter the row number to be deleted and then click on a delete button and have a delete query ran on the database, that's one boring ugly way to do it. But what would really be nice is if when the user right clicked on the row number at the left of the sheet and then selected delete from the right-click menu that action would cause code to run that ran a delete query on the database. I guess what I need is a delete_event, but there doesn't appear to be a delete_event, the closest being a selection_change event. But the selection_change event doesn't seem to help becasue there doesn't seem to be any way to determine if a selection was deleted when a selection_change occurs. Mi amigos, please help me!
 
On 2002-04-19 12:18, Cosmos75 wrote:
dhoffman,

How do I pull records from a database, mush less have two two update each other? What would be the access code for what Tommy Bak gave?

Am trying to lean VBA for excel and Access. I appreciate any help you can give

It's actually pretty easy to do in VBA, just use Data Access Objects. firsty thing is if you're running code from Excel you need to open the Access database:
dim db as database
set db = opendatabase("c:validpathdatabsename")

Then to retrieve records what I usually do is assign an SQL statement to a string variable and use that to open a recordset like so:
dim strSQL as string
dim rs as recordset
strSQL = "SELECT * FROM TABLE1;" 'or something more complex
set rs = db.openrecordset(strSQL)

There are various ways to work with a recordset object. This info is all available in VBA Help. Make sure that your VBA references under Tools > References includes DAO 3.6 Object Library. I hope this helps you get started.
 
Upvote 0

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
On 2002-04-19 12:24, Jack in the UK wrote:
chris D or any of my frriends i do not understandering, my above post asked what some think ment????

Jack - he then went on to say :

"Perhpas I get a little carried away, that babbling didn't really make any sense in any language."

which is cool.... I was having trouble understanding the "donate to volunteer" bit aswell....!

Oh well, all's well that ends well :)
 
Upvote 0
Cheers Chris...

the world is getting closer if more troubled, and tolerance is a must something generally is a rule that an exceptance..

English rules the world as Microsoft Excel does.. but intranslation is can get lost and raws text make it worst.

but how these guys all over the wold post in english?????

i tip my hat (thats means good well done)

Better that I!
 
Upvote 0

Forum statistics

Threads
1,213,531
Messages
6,114,167
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top