View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.misc
Secret Squirrel
 
Posts: n/a
Default excel to access problem

Is there a way to erase the contents of the table every time you upload from
excel? What I want to do is erase or overwrite the data in table1 everytime I
click the upload command button.

"Conrad Carlberg" wrote:

Hi Larry,

One way to get the code to run is to stick a button on the worksheet, and
associate the code with the button, so that when the user clicks the button
the code runs. But that's not fully automatic.

The other way is to use an event handler. Right-click the tab of the
worksheet where you're entering data and choose the View Code menu item.
You'll be escorted to the VBE with a new module. Use the dropdowns to choose
Worksheet, and Change. The Change event has a Target argument, representing
a cell. You can use that Target argument to check the cell's column
(Target.Column).

If it's reasonable to assume that the user has finished entering data when
the Target.Column equals, say, 3, run your code. Something like this:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 3 Then
ADOFromExcelToAccess
End If
End Sub

--
C^2
Conrad Carlberg

Excel Sales Forecasting for Dummies, Wiley, 2005


"keithl816" wrote
in message ...

Hi again,

I figured out how to get the data to go to access, my path to the db
was wrong and the start row was incorrect, now the question is, do I
have to go into the mvb and click run/runsub/userform everytime or is
there a way to get that module to run automatically everytime I finish
entering data?

I've been trying to make this work for over two weeks and feel I am
very close to accomplishing what I'm trying to do. Every bit of help is
appreciated. and thanks to everybody that has replied.

Larry


--
keithl816
------------------------------------------------------------------------
keithl816's Profile:

http://www.excelforum.com/member.php...o&userid=21287
View this thread: http://www.excelforum.com/showthread...hreadid=474422