<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>Bytes - insights</title>
		<link>http://bytes.com</link>
		<description><![CDATA[Microsoft Office Access database and VBA guides, how to's and articles written by community experts.  Topics include: queries, reports, forms, macros, modules, security, automation, functions, records, mining and more.]]></description>
		<language>en</language>
		<lastBuildDate>Sat, 21 Nov 2009 01:05:02 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://bytes.com/images/misc/rss.jpg</url>
			<title>Bytes - insights</title>
			<link>http://bytes.com</link>
		</image>
		<item>
			<title>Relinking odbc tables using VBA</title>
			<link>http://bytes.com/topic/access/insights/876985-relinking-odbc-tables-using-vba</link>
			<pubDate>Fri, 13 Nov 2009 15:07:49 GMT</pubDate>
			<description>As a lot of my projects involve using an odbc linked backend data source I have found this piece of code to be very useful.  I usually trigger it to...</description>
			<content:encoded><![CDATA[<div>As a lot of my projects involve using an odbc linked backend data source I have found this piece of code to be very useful.  I usually trigger it to run on system startup like in AutoExec macro.  It avoids any difficulties down the road with broken links and if the DSN name or database server changes then the only edit that needs to be made is to the connection string.<br />
<br />
<!-- CODE -->
<div id="codeHolder" class="codeHolder" style="width: 500px;">
<div class="codeHeader">
	<span class="codeLink" onclick="Blur(this, this.parentNode.parentNode, getChildren(this),true);">Expand</span><span class="codeDivider">|</span><span class="codeLink" onclick="selectAll(this);">Select</span><span class="codeDivider">|</span><span class="codeLink" onclick="WordWrap(this);">Wrap</span><span class="codeDivider">|</span><span class="codeLink" onclick="LineNumbers(this);">Line Numbers</span>
</div>

<div class="codeContent" style="display: block; width: 500px; white-space: nowrap;">
	<ol START="1" highlight="true">

<li class="codeLI">
Function&nbsp;relinkTables()</li>
<li class="codeLI">
Dim&nbsp;tdf&nbsp;As&nbsp;DAO.TableDef</li>
<li class="codeLI">&nbsp;</li>
<li class="codeLI">
&nbsp;&nbsp;&nbsp;&nbsp;For&nbsp;Each&nbsp;tdf&nbsp;In&nbsp;CurrentDb.TableDefs</li>
<li class="codeLI">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'&nbsp;check&nbsp;if&nbsp;table&nbsp;is&nbsp;a&nbsp;linked&nbsp;table</li>
<li class="codeLI">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;Len(tdf.Connect)&nbsp;&gt;&nbsp;0&nbsp;Then</li>
<li class="codeLI">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tdf.Connect&nbsp;=&nbsp;&quot;odbc&nbsp;connection&nbsp;string&nbsp;to&nbsp;the&nbsp;DSN&nbsp;or&nbsp;database&quot;</li>
<li class="codeLI">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tdf.RefreshLink</li>
<li class="codeLI">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;If</li>
<li class="codeLI">
&nbsp;&nbsp;&nbsp;&nbsp;Next</li>
<li class="codeLI">&nbsp;</li>
<li class="codeLI">
End&nbsp;Function</li>
<li class="codeLI">&nbsp;</li>

	</ol>
</div>
</div>
<!-- /CODE -->


<b>Note:</b>  If you have other linked tables aside from those connected by odbc you would have to allow for them in the code.<br />
<br />
As usual all advice, critique and enhancements welcome :)<br />
<br />
Mary</div>

]]></content:encoded>
			<category domain="http://bytes.com/topic/access/insights/">insights</category>
			<dc:creator>msquared</dc:creator>
			<guid isPermaLink="true">http://bytes.com/topic/access/insights/876985-relinking-odbc-tables-using-vba</guid>
		</item>
		<item>
			<title>Format system time to milliseconds in VBA</title>
			<link>http://bytes.com/topic/access/insights/876984-format-system-time-milliseconds-vba</link>
			<pubDate>Fri, 13 Nov 2009 14:54:25 GMT</pubDate>
			<description>I found I needed this recently when creating a file which had to be uploaded by ftp.  The file extension was a timestamp of hhnnssms and the ms part...</description>
			<content:encoded><![CDATA[<div>I found I needed this recently when creating a file which had to be uploaded by ftp.  The file extension was a timestamp of hhnnssms and the ms part was formatted to 4 digits.  As the Now() function doesn't return milliseconds I used the following function to calculate it.<br />
<br />
<!-- CODE -->
<div id="codeHolder" class="codeHolder" style="width: 500px;">
<div class="codeHeader">
	<span class="codeLink" onclick="Blur(this, this.parentNode.parentNode, getChildren(this),true);">Expand</span><span class="codeDivider">|</span><span class="codeLink" onclick="selectAll(this);">Select</span><span class="codeDivider">|</span><span class="codeLink" onclick="WordWrap(this);">Wrap</span><span class="codeDivider">|</span><span class="codeLink" onclick="LineNumbers(this);">Line Numbers</span>
</div>

<div class="codeContent" style="display: block; width: 500px; white-space: nowrap;">
	<ol START="1" highlight="true">

<li class="codeLI">
Option&nbsp;Compare&nbsp;Database</li>
<li class="codeLI">
Option&nbsp;Explicit</li>
<li class="codeLI">&nbsp;</li>
<li class="codeLI">
Private&nbsp;Type&nbsp;SYSTEMTIME</li>
<li class="codeLI">
wYear&nbsp;As&nbsp;Integer</li>
<li class="codeLI">
wMonth&nbsp;As&nbsp;Integer</li>
<li class="codeLI">
wDayOfWeek&nbsp;As&nbsp;Integer</li>
<li class="codeLI">
wDay&nbsp;As&nbsp;Integer</li>
<li class="codeLI">
wHour&nbsp;As&nbsp;Integer</li>
<li class="codeLI">
wMinute&nbsp;As&nbsp;Integer</li>
<li class="codeLI">
wSecond&nbsp;As&nbsp;Integer</li>
<li class="codeLI">
wMilliseconds&nbsp;As&nbsp;Integer</li>
<li class="codeLI">
End&nbsp;Type</li>
<li class="codeLI">&nbsp;</li>
<li class="codeLI">&nbsp;</li>
<li class="codeLI">
Private&nbsp;Declare&nbsp;Sub&nbsp;GetSystemTime&nbsp;Lib&nbsp;&quot;kernel32&quot;&nbsp;_</li>
<li class="codeLI">
(lpSystemTime&nbsp;As&nbsp;SYSTEMTIME)</li>
<li class="codeLI">&nbsp;</li>
<li class="codeLI">
Public&nbsp;Function&nbsp;TimeToMillisecond()&nbsp;As&nbsp;String</li>
<li class="codeLI">
Dim&nbsp;tSystem&nbsp;As&nbsp;SYSTEMTIME</li>
<li class="codeLI">
Dim&nbsp;sRet</li>
<li class="codeLI">&nbsp;</li>
<li class="codeLI">
&nbsp;&nbsp;&nbsp;&nbsp;On&nbsp;Error&nbsp;Resume&nbsp;Next</li>
<li class="codeLI">&nbsp;</li>
<li class="codeLI">
&nbsp;&nbsp;&nbsp;&nbsp;GetSystemTime&nbsp;tSystem</li>
<li class="codeLI">&nbsp;</li>
<li class="codeLI">
&nbsp;&nbsp;&nbsp;&nbsp;sRet&nbsp;=&nbsp;Hour(Now)&nbsp;&amp;&nbsp;Minute(Now)&nbsp;&amp;&nbsp;Second(Now)&nbsp;&amp;&nbsp;Format(tSystem.wMilliseconds,&nbsp;&quot;0000&quot;)</li>
<li class="codeLI">&nbsp;</li>
<li class="codeLI">
&nbsp;&nbsp;&nbsp;&nbsp;TimeToMillisecond&nbsp;=&nbsp;sRet</li>
<li class="codeLI">&nbsp;</li>
<li class="codeLI">
End&nbsp;Function</li>
<li class="codeLI">&nbsp;</li>

	</ol>
</div>
</div>
<!-- /CODE -->


As usual all advice, critique and enhancements welcome :)<br />
<br />
Mary</div>

]]></content:encoded>
			<category domain="http://bytes.com/topic/access/insights/">insights</category>
			<dc:creator>msquared</dc:creator>
			<guid isPermaLink="true">http://bytes.com/topic/access/insights/876984-format-system-time-milliseconds-vba</guid>
		</item>
		<item>
			<title>Using msoFileDialogSaveAs in MS Access</title>
			<link>http://bytes.com/topic/access/insights/876982-using-msofiledialogsaveas-ms-access</link>
			<pubDate>Fri, 13 Nov 2009 14:44:43 GMT</pubDate>
			<description>I recently had occasion to want to export the results of a query from Access to Excel using FileDialog.  I found researching it that there was a lot...</description>
			<content:encoded><![CDATA[<div>I recently had occasion to want to export the results of a query from Access to Excel using FileDialog.  I found researching it that there was a lot of confusion regarding whether SaveAs could even be used in Access and couldn't find a simple routine.  I experimented a little and came up with the following which works perfectly.  <br />
<br />
Although I used this routine to export to Excel it could in theory be used with any format supported by DoCmd.Output or really any statement which output a file.<br />
<br />
<!-- CODE -->
<div id="codeHolder" class="codeHolder" style="width: 500px;">
<div class="codeHeader">
	<span class="codeLink" onclick="Blur(this, this.parentNode.parentNode, getChildren(this),true);">Expand</span><span class="codeDivider">|</span><span class="codeLink" onclick="selectAll(this);">Select</span><span class="codeDivider">|</span><span class="codeLink" onclick="WordWrap(this);">Wrap</span><span class="codeDivider">|</span><span class="codeLink" onclick="LineNumbers(this);">Line Numbers</span>
</div>

<div class="codeContent" style="display: block; width: 500px; white-space: nowrap;">
	<ol START="1" highlight="true">

<li class="codeLI">
Private&nbsp;Sub&nbsp;cmdSendtoExcel_Click()</li>
<li class="codeLI">
Dim&nbsp;fd&nbsp;As&nbsp;FileDialog</li>
<li class="codeLI">
Dim&nbsp;Title&nbsp;As&nbsp;String</li>
<li class="codeLI">
Dim&nbsp;vrtSelectedItem&nbsp;As&nbsp;Variant</li>
<li class="codeLI">&nbsp;</li>
<li class="codeLI">
&nbsp;&nbsp;&nbsp;&nbsp;Set&nbsp;fd&nbsp;=&nbsp;Application.FileDialog(msoFileDialogSaveAs)</li>
<li class="codeLI">&nbsp;</li>
<li class="codeLI">
&nbsp;&nbsp;&nbsp;&nbsp;With&nbsp;fd</li>
<li class="codeLI">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.AllowMultiSelect&nbsp;=&nbsp;False</li>
<li class="codeLI">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Title&nbsp;=&nbsp;&quot;Save&nbsp;File&quot;</li>
<li class="codeLI">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.InitialFileName&nbsp;=&nbsp;&quot;Name&nbsp;Of&nbsp;Report&nbsp;&quot;&nbsp;&amp;&nbsp;Format(Now(),&nbsp;&quot;ddmmyyyyhhnn&quot;)&nbsp;&amp;&nbsp;&quot;.xls&quot;</li>
<li class="codeLI">&nbsp;</li>
<li class="codeLI">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;.Show&nbsp;=&nbsp;True&nbsp;Then</li>
<li class="codeLI">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;For&nbsp;Each&nbsp;vrtSelectedItem&nbsp;In&nbsp;.SelectedItems</li>
<li class="codeLI">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DoCmd.OutputTo&nbsp;acOutputQuery,&nbsp;&quot;query&nbsp;or&nbsp;table&nbsp;name&quot;,&nbsp;acFormatXLS,&nbsp;vrtSelectedItem</li>
<li class="codeLI">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Next&nbsp;vrtSelectedItem</li>
<li class="codeLI">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Else</li>
<li class="codeLI">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MsgBox&nbsp;&quot;No&nbsp;file&nbsp;was&nbsp;selected&quot;</li>
<li class="codeLI">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;If</li>
<li class="codeLI">&nbsp;</li>
<li class="codeLI">
&nbsp;&nbsp;&nbsp;&nbsp;End&nbsp;With</li>
<li class="codeLI">&nbsp;</li>
<li class="codeLI">
End&nbsp;Sub</li>
<li class="codeLI">&nbsp;</li>

	</ol>
</div>
</div>
<!-- /CODE -->


If anyone knows of any improvedments or enhancements to this routine feel free to offer advice.<br />
<br />
Mary</div>

]]></content:encoded>
			<category domain="http://bytes.com/topic/access/insights/">insights</category>
			<dc:creator>msquared</dc:creator>
			<guid isPermaLink="true">http://bytes.com/topic/access/insights/876982-using-msofiledialogsaveas-ms-access</guid>
		</item>
	</channel>
</rss>
