ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add a value from Excel to a form in access (https://www.excelbanter.com/excel-programming/329276-add-value-excel-form-access.html)

Kevbrad1

Add a value from Excel to a form in access
 
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

Kevbrad1

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



All times are GMT +1. The time now is 08:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com