PC Review


Reply
Thread Tools Rate Thread

ADO excel VBA to update data in Access

 
 
=?Utf-8?B?QW5ndXM=?=
Guest
Posts: n/a
 
      7th May 2007
Please help. I need VBA excel code by ADO for following:

I have two columns in Excel and Access table.

In Excel
Column A Column B
1000 $350
1001 $420
1002 $470
1003 $50

In Access
Column A Column B
1000
1001
1002
1003

I want to update Access column B according to data in column A

 
Reply With Quote
 
 
 
 
Norman Jones
Guest
Posts: n/a
 
      7th May 2007
Hi Angus,

See Ole P. Erlandsen at:

Export data from Excel to Access (ADO)
http://www.erlandsendata.no/english/...badacexportado


---
Regards,
Norman


"Angus" <(E-Mail Removed)> wrote in message
news:8CDD098B-93A5-4BA4-AB99-(E-Mail Removed)...
> Please help. I need VBA excel code by ADO for following:
>
> I have two columns in Excel and Access table.
>
> In Excel
> Column A Column B
> 1000 $350
> 1001 $420
> 1002 $470
> 1003 $50
>
> In Access
> Column A Column B
> 1000
> 1001
> 1002
> 1003
>
> I want to update Access column B according to data in column A
>



 
Reply With Quote
 
=?Utf-8?B?QW5ndXM=?=
Guest
Posts: n/a
 
      14th Jun 2007
This is great to add new record in Access.

But what if now I need to update the record in Access, instead of add new.
eg, in excel, i have two columns, column A is a unique key value from Access
and I will update the record in Access according to column A, and column B is
what I want to update.

Column A Column B
123 May
124 June
125 June

and the program will lookup the key in table, if it is 123 then update
"May", if 124 then update "June"...so on.

"Norman Jones" wrote:

> Hi Angus,
>
> See Ole P. Erlandsen at:
>
> Export data from Excel to Access (ADO)
> http://www.erlandsendata.no/english/...badacexportado
>
>
> ---
> Regards,
> Norman
>
>
> "Angus" <(E-Mail Removed)> wrote in message
> news:8CDD098B-93A5-4BA4-AB99-(E-Mail Removed)...
> > Please help. I need VBA excel code by ADO for following:
> >
> > I have two columns in Excel and Access table.
> >
> > In Excel
> > Column A Column B
> > 1000 $350
> > 1001 $420
> > 1002 $470
> > 1003 $50
> >
> > In Access
> > Column A Column B
> > 1000
> > 1001
> > 1002
> > 1003
> >
> > I want to update Access column B according to data in column A
> >

>
>
>

 
Reply With Quote
 
david12
Guest
Posts: n/a
 
      16th Jun 2007
On Jun 13, 11:33 pm, Angus <A...@discussions.microsoft.com> wrote:
> This is great to add new record inAccess.
>
> But what if now I need to update the record inAccess, instead of add new.
> eg, in excel, i have two columns, column A is a unique key value fromAccess
> and I will update the record inAccessaccording to column A, and column B is
> what I want to update.
>
> Column A Column B
> 123 May
> 124 June
> 125 June
>
> and the program will lookup the key in table, if it is 123 then update
> "May", if 124 then update "June"...so on.
>
> "Norman Jones" wrote:
> > Hi Angus,

>
> > See Ole P. Erlandsen at:

>
> > Export data from Excel toAccess(ADO)
> > http://www.erlandsendata.no/english/...badacexportado

>
> > ---
> > Regards,
> > Norman

>
> > "Angus" <A...@discussions.microsoft.com> wrote in message
> >news:8CDD098B-93A5-4BA4-AB99-(E-Mail Removed)...
> > > Please help. I need VBA excel code by ADO for following:

>
> > > I have two columns in Excel andAccesstable.

>
> > > In Excel
> > > Column A Column B
> > > 1000 $350
> > > 1001 $420
> > > 1002 $470
> > > 1003 $50

>
> > > InAccess
> > > Column A Column B
> > > 1000
> > > 1001
> > > 1002
> > > 1003

>
> > > I want to updateAccesscolumn B according to data in column A


Try this (all steps are in Access):

1. Make a table that holds the data from the Excel spreadsheet. You
can either import or link to it using menu choices: File>External
Data>Import or ...Link. (Link is quicker as it doesn't need to define
fields.)
2. Create a new query, go to SQL view and paste the following SQL text
there:
UPDATE AccessTable INNER JOIN ExcelTable ON [ExcelTable].[ColumnA] =
[AccessTable].[ColumnA] SET [AccessTable].[ColumnB] = [ExcelTable].
[ColumnA];
3. Change the names of the 2 tables (AccessTable and ExcelTable) and 2
fields (ColumnA and ColumnB) as needed to fit your names.
4. Run the query.
5. Open the AccessTable. ColumnB should contain all the stuff in
ColumnB from the Excel table according to ColumnA.
6. If an error results or the results are not what you want, it may be
because the the data types are different. Just change the 2 fields so
they match and try again. From your example, it looks like you can go
with all Numbers.

Dave

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel form to update data from MS Access data table based on criteriain excel sheet Santa-D Microsoft Excel Programming 2 13th May 2008 03:43 AM
How do I access the access data via Excel 2002 with auto update ? =?Utf-8?B?a2FydGhpaw==?= Microsoft Excel Programming 1 9th Feb 2007 01:56 PM
Update Excel with Access data Tim Microsoft Access External Data 2 13th May 2004 12:14 PM
using excel to update data in access Mike Microsoft Excel Misc 1 12th Feb 2004 04:04 AM
Importing excel into access - want access to update data supplied from excel Deborah Microsoft Access External Data 1 30th Jul 2003 01:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:28 AM.