Select - Highlight Record

  • Thread starter Thread starter WireGuy
  • Start date Start date
W

WireGuy

I'm trying to copy data from Excel to Access via an Excel Macro. My plan is
to place the data on the clip board and open an Access form (datasheet
view(data-entry only)). I get this part accomplished, but I need to
highlight the entire row in the Access form before pasting. Is there a
command that will highlight the entire row (only row available since it is
data entry only)? See sample code below:

Dim objAccess As Access.Application

Range("B2:C2").Select
Selection.Copy

Dim strDb As String
Dim strForm As String

strDb = "\\Kxxxx9\kx-operations\QUALITY\RFQ-APQP.mdb"
strForm = "testform"

Set objAccess = New Access.Application
With objAccess
.OpenCurrentDatabase strDb
.DoCmd.OpenForm strForm, acFormDS
.Visible = True
.DoCmd.Maximize
"I want to select the entire Access record or row here'
"then I'll need to paste the data"

Thanks for the help!
 
WireGuy,

No, this is not possible.

In general, copy/paste is an inappropriate way to manage data in a database.

There may be other ways, but I would consider driving this from within
Access, to import the data from your Excel file via the
TransferSpreadsheet method.

Alternatively you could process one cell at a time from Excel, writing
the contents to a variable that you then use within an Append Query or
Update Query to write it into the Access table.
 
Back
Top