View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Kevbrad1 Kevbrad1 is offline
external usenet poster
 
Posts: 2
Default Add a value from Excel to a form in access

Hi Again,
Did not receive any responses to my post, and have managed to suss it for
myself, so am pretty sure others may find this useful, as its took a while to
sort.
I am not sure whether this is the prettyest way to do this, or whether
theres another easier way, as I am a newbie to VB, but it works, so here goes-

Sub openaccess()

Dim AccessApp As Object
a = ActiveCell.Value
Set AccessApp = CreateObject("Access.Application")
AccessApp.Visible = True
AccessApp.OpenCurrentDatabase "C:\db1.mdb"
AccessApp.UserControl = True

AppActivate "Sheet1"
SendKeys a, True

SendKeys "{ENTER}", True
AccessApp.UserControl = True
End Sub

Still would appreciate some feedback, as Id like to see other ways.

Kevbrad1

"Kevbrad1" wrote:

Hi, I want to be able to click on a cell in excel, and open access database
form, and automatically insert the value from the excel cell.

I have sussed out opening access and the form, would just like help on
pasting the value from the cell in excel into the form field in access (The
field has focus).

Any sugestions much appreciated.

Thanks