Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 25th, 2007, 07:56 AM
Friend of Wrox
 
Join Date: Apr 2007
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default Table records updation from Excel Sheets

Hi All

I hope every enjoying this forum and nice day

Problem Statement
Table ABC imports data from Excel sheet every week when prices(field) changes, now i have to update only those record which is change in a week so not every record updated.

itemno itemname itemprice
001 XXXX 1.1

if itemprice changes it will update record otherwise no change

At the moment i am doing this which is ok but not looks good

r.Open "ExcelSheetLinkTable", CurrentProject.Connection, adOpenForwardOnly, adLockReadOnly
t.Open "AccessTable", CurrentProject.Connection, adOpenKeyset, adLockOptimistic

'Updateing record into Access table BOMTestData if its not new
Do While Not r.EOF And Not t.EOF
If Nz(r!f1, "") <> "" And Nz(r!f2, "") <> "" And Nz(r!f4, "") <> "" Then
If r!f2 >= 1 Then
If t!Price <> r!f4 Then
't.AddNew
t!SXID = r!f8
t!PID = r!f1
t!MinQuan = r!f2
t!Currency = r!f3
t!Price = r!f4
t.Update
Else
'Error
End If
Else
'Error
End If
Else
'Error
Exit Do
End If
t.movenext
r.movenext
Loop







Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing two excel sheets nbkn8ct Excel VBA 5 August 28th, 2009 05:20 PM
Table updation - SQL 2000 carumuga SQL Server 2000 1 July 21st, 2008 03:43 AM
Working with excel sheets ramsri VB How-To 1 October 25th, 2007 03:15 PM
Import From excel with n sheets dbellavi SQL Server DTS 1 September 11th, 2007 07:51 AM
Exporting Table to Excel Sheets ayazhoda Access VBA 11 April 5th, 2007 07:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.