<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Select From or Update a Database Table Based on the Contents of an Excel Spreadsheet</title>
	<atom:link href="http://hoopercharles.wordpress.com/2010/01/12/select-from-or-update-a-database-table-based-on-the-contents-of-an-excel-spreadsheet/feed/" rel="self" type="application/rss+xml" />
	<link>http://hoopercharles.wordpress.com/2010/01/12/select-from-or-update-a-database-table-based-on-the-contents-of-an-excel-spreadsheet/</link>
	<description>Miscellaneous Random Oracle Topics: Stop, Think, ... Understand</description>
	<lastBuildDate>Thu, 13 Jun 2013 22:46:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2010/01/12/select-from-or-update-a-database-table-based-on-the-contents-of-an-excel-spreadsheet/#comment-4981</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Sun, 14 Oct 2012 13:10:28 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=796#comment-4981</guid>
		<description><![CDATA[Tony,

I do not see why you could not use a variation of my macro to do what you describe.  However, it makes sense to first try tracing (with a 10046 level 4 trace) what the program does when the supplier delivery dates are modified through the application interface.  You only need to be concerned with those SQL statements that are indicated with dep=0.  There is a chance that the application interface also updates rows in other tables when the dates are changed.

Note that the macro in this article moves down column A in a worksheet, stopping when the first blank cell in column A is found.  So, what if you need the macro to continue searching through the rows until the last row in the worksheet is reached (skipping those rows with a blank in the searched column)?  You can modify the macro similar to the following - note that cell A1 must contain something, even a blank space, for the macro to work correctly, so that is why the macro checks that cell.  Notice that this macro references the cells using &lt;b&gt;row, column&lt;/b&gt; syntax rather than &lt;b&gt;D1, D2, D3&lt;/b&gt;, etc. syntax: 
&lt;pre&gt;
Sub CheckSpreadsheet()
    Dim lngRows As Long
    Dim lngCols As Long
    
    Dim i As Long
    Dim j As Long
    
    Dim strExcelValue As String
    Dim strSQL As String
    
    Dim dbMyDB As New ADODB.Connection
    Dim snpData As New ADODB.Recordset
    
    &#039;You must create a reference to Microsoft ActiveX Data Objects (Tools menu)
    &#039;Make sure that we don&#039;t crash - will look ugly if our macro crashes
    On Error Resume Next
    &#039;Replace MyODBCConnection with an ODBC connection name, MyUserName with a database user name and MyPassword with the user&#039;s password
    dbMyDB.ConnectionString = &quot;Data Source=MyODBCConnection;User ID=MyUserName;Password=MyPassword;&quot;
    dbMyDB.ConnectionTimeout = 40
    dbMyDB.CursorLocation = adUseClient
    dbMyDB.Open

    &#039;Cell A1 (referenced by ActiveSheet.Cells(1, 1)) must not be blank
    If ActiveSheet.Cells(1, 1) = &quot;&quot; Then
        ActiveSheet.Cells(1, 1) = &quot; &quot;
    End If
    
    lngRows = ActiveSheet.UsedRange.Rows.Count
    lngCols = ActiveSheet.UsedRange.Columns.Count
    
    MsgBox &quot;Row Count: &quot; &amp; Format(lngRows)
    MsgBox &quot;Column Count: &quot; &amp; Format(lngCols)
    
    i = 4 &#039;We will check the values in the fourth column (D)
    
    For j = 1 To lngRows
        strExcelValue = Format(ActiveSheet.Cells(j, i).Value)
        If strExcelValue = &quot;&quot; Then
            &#039;There is nothing in this cell, skip the row
        Else
            &#039;Run the SQL statement here
            MsgBox strExcelValue
        End If
    Next j
    
    dbMyDB.Close
    Set snpData = Nothing
    Set dbMyDB = Nothing
End Sub
&lt;/pre&gt;]]></description>
		<content:encoded><![CDATA[<p>Tony,</p>
<p>I do not see why you could not use a variation of my macro to do what you describe.  However, it makes sense to first try tracing (with a 10046 level 4 trace) what the program does when the supplier delivery dates are modified through the application interface.  You only need to be concerned with those SQL statements that are indicated with dep=0.  There is a chance that the application interface also updates rows in other tables when the dates are changed.</p>
<p>Note that the macro in this article moves down column A in a worksheet, stopping when the first blank cell in column A is found.  So, what if you need the macro to continue searching through the rows until the last row in the worksheet is reached (skipping those rows with a blank in the searched column)?  You can modify the macro similar to the following &#8211; note that cell A1 must contain something, even a blank space, for the macro to work correctly, so that is why the macro checks that cell.  Notice that this macro references the cells using <b>row, column</b> syntax rather than <b>D1, D2, D3</b>, etc. syntax: </p>
<pre>
Sub CheckSpreadsheet()
    Dim lngRows As Long
    Dim lngCols As Long
    
    Dim i As Long
    Dim j As Long
    
    Dim strExcelValue As String
    Dim strSQL As String
    
    Dim dbMyDB As New ADODB.Connection
    Dim snpData As New ADODB.Recordset
    
    'You must create a reference to Microsoft ActiveX Data Objects (Tools menu)
    'Make sure that we don't crash - will look ugly if our macro crashes
    On Error Resume Next
    'Replace MyODBCConnection with an ODBC connection name, MyUserName with a database user name and MyPassword with the user's password
    dbMyDB.ConnectionString = "Data Source=MyODBCConnection;User ID=MyUserName;Password=MyPassword;"
    dbMyDB.ConnectionTimeout = 40
    dbMyDB.CursorLocation = adUseClient
    dbMyDB.Open

    'Cell A1 (referenced by ActiveSheet.Cells(1, 1)) must not be blank
    If ActiveSheet.Cells(1, 1) = "" Then
        ActiveSheet.Cells(1, 1) = " "
    End If
    
    lngRows = ActiveSheet.UsedRange.Rows.Count
    lngCols = ActiveSheet.UsedRange.Columns.Count
    
    MsgBox "Row Count: " &amp; Format(lngRows)
    MsgBox "Column Count: " &amp; Format(lngCols)
    
    i = 4 'We will check the values in the fourth column (D)
    
    For j = 1 To lngRows
        strExcelValue = Format(ActiveSheet.Cells(j, i).Value)
        If strExcelValue = "" Then
            'There is nothing in this cell, skip the row
        Else
            'Run the SQL statement here
            MsgBox strExcelValue
        End If
    Next j
    
    dbMyDB.Close
    Set snpData = Nothing
    Set dbMyDB = Nothing
End Sub
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tony</title>
		<link>http://hoopercharles.wordpress.com/2010/01/12/select-from-or-update-a-database-table-based-on-the-contents-of-an-excel-spreadsheet/#comment-4980</link>
		<dc:creator><![CDATA[Tony]]></dc:creator>
		<pubDate>Sat, 13 Oct 2012 19:05:32 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=796#comment-4980</guid>
		<description><![CDATA[Hi Charles, 
Can the above also be used to update supplier delivery dates. For example if i send out a blanket purchase order to a supplier based on an annual quantity of 52K and call off quantities of 1k a week, there may be weeks when i need more. Oracle would then request me to pull some delivery dates forward. I can export these pull forwards into excel. When the supplier replies with the new delivery dates in Excel can I upload these new dates ? 

It would save a lot of time rather than going into Oracle and having to change each line manually. Particularly when you have to update over 100 lines.]]></description>
		<content:encoded><![CDATA[<p>Hi Charles,<br />
Can the above also be used to update supplier delivery dates. For example if i send out a blanket purchase order to a supplier based on an annual quantity of 52K and call off quantities of 1k a week, there may be weeks when i need more. Oracle would then request me to pull some delivery dates forward. I can export these pull forwards into excel. When the supplier replies with the new delivery dates in Excel can I upload these new dates ? </p>
<p>It would save a lot of time rather than going into Oracle and having to change each line manually. Particularly when you have to update over 100 lines.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2010/01/12/select-from-or-update-a-database-table-based-on-the-contents-of-an-excel-spreadsheet/#comment-232</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Sat, 23 Jan 2010 02:02:37 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=796#comment-232</guid>
		<description><![CDATA[Ben, thanks for the compliment regarding the contents of the blog - some of the articles required a significant amount of time to put together.  It is good to hear that people are finding some of the articles to be interesting.]]></description>
		<content:encoded><![CDATA[<p>Ben, thanks for the compliment regarding the contents of the blog &#8211; some of the articles required a significant amount of time to put together.  It is good to hear that people are finding some of the articles to be interesting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Weiss</title>
		<link>http://hoopercharles.wordpress.com/2010/01/12/select-from-or-update-a-database-table-based-on-the-contents-of-an-excel-spreadsheet/#comment-227</link>
		<dc:creator><![CDATA[Ben Weiss]]></dc:creator>
		<pubDate>Fri, 22 Jan 2010 16:16:58 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=796#comment-227</guid>
		<description><![CDATA[Hi Charles - Great blog! You have a wide ranging mix of Oracle topics, and it&#039;s cool to see some VBA thrown in. I wanted to share with you my own Excel VBA tool that queries Oracle, SQL Server and MS-Access and enables end users to add their own queries. Go to http://dbbulletin.wordpress.com/downloads and take a look at the &quot;Data Getter&quot; section.
cheers,
Ben]]></description>
		<content:encoded><![CDATA[<p>Hi Charles &#8211; Great blog! You have a wide ranging mix of Oracle topics, and it&#8217;s cool to see some VBA thrown in. I wanted to share with you my own Excel VBA tool that queries Oracle, SQL Server and MS-Access and enables end users to add their own queries. Go to <a href="http://dbbulletin.wordpress.com/downloads" rel="nofollow">http://dbbulletin.wordpress.com/downloads</a> and take a look at the &#8220;Data Getter&#8221; section.<br />
cheers,<br />
Ben</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg</title>
		<link>http://hoopercharles.wordpress.com/2010/01/12/select-from-or-update-a-database-table-based-on-the-contents-of-an-excel-spreadsheet/#comment-174</link>
		<dc:creator><![CDATA[Greg]]></dc:creator>
		<pubDate>Thu, 14 Jan 2010 08:13:54 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=796#comment-174</guid>
		<description><![CDATA[Got it, thanks .
Regards
Greg]]></description>
		<content:encoded><![CDATA[<p>Got it, thanks .<br />
Regards<br />
Greg</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2010/01/12/select-from-or-update-a-database-table-based-on-the-contents-of-an-excel-spreadsheet/#comment-173</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Thu, 14 Jan 2010 03:52:28 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=796#comment-173</guid>
		<description><![CDATA[See the example of adding a reference to the Microsoft ActiveX Data Objects in this blog article:
http://hoopercharles.wordpress.com/2009/12/28/extract-1834-images-from-excel-2007-and-transfer-to-a-database-table/]]></description>
		<content:encoded><![CDATA[<p>See the example of adding a reference to the Microsoft ActiveX Data Objects in this blog article:<br />
<a href="http://hoopercharles.wordpress.com/2009/12/28/extract-1834-images-from-excel-2007-and-transfer-to-a-database-table/" rel="nofollow">http://hoopercharles.wordpress.com/2009/12/28/extract-1834-images-from-excel-2007-and-transfer-to-a-database-table/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg</title>
		<link>http://hoopercharles.wordpress.com/2010/01/12/select-from-or-update-a-database-table-based-on-the-contents-of-an-excel-spreadsheet/#comment-172</link>
		<dc:creator><![CDATA[Greg]]></dc:creator>
		<pubDate>Wed, 13 Jan 2010 18:31:18 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=796#comment-172</guid>
		<description><![CDATA[Hi,
 what do You mean by &#039;You must create a reference to Microsoft ActiveX Data Objects &#039; ?]]></description>
		<content:encoded><![CDATA[<p>Hi,<br />
 what do You mean by &#8216;You must create a reference to Microsoft ActiveX Data Objects &#8216; ?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
