<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Load Event Only Works in Preview</title><link>https://www.infopathdev.com:443/forums/thread/81512.aspx</link><pubDate>Wed, 08 Aug 2012 18:38:12 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:81512</guid><dc:creator>shep123</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/81512.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=81512</wfw:commentRss><description>Solved I changed my equation to: substring-before(@UpdateDate[@Name = &amp;quot;Date Last Modified&amp;quot;], &amp;quot;T&amp;quot;)</description></item><item><title>Re: Load Event Only Works in Preview</title><link>https://www.infopathdev.com:443/forums/thread/81510.aspx</link><pubDate>Wed, 08 Aug 2012 18:34:05 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:81510</guid><dc:creator>shep123</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/81510.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=81510</wfw:commentRss><description>I think I&amp;#39;ve pretty much figured it out so I will lay out the steps here. &lt;br /&gt;
&lt;br /&gt;
1. I made the Access Query&lt;br /&gt;
SELECT MSysObjects.DateCreate, CDate(Int(DateUpdate)) AS UpdateDate, MSysObjects.Name, MSysObjects.Type&lt;br /&gt;
FROM MSysObjects;&lt;br /&gt;

2. Created a data connected in InfoPath with the Date Last Modified (the query I created)&lt;br /&gt;
&lt;br /&gt;
3. Inserted a text box to serve as a timestamp&lt;br /&gt;

4. Set the default value to  @UpdateDate[@Name = &amp;quot;Date Last Modified&amp;quot;]&lt;br /&gt;
Now this all works except that it provides that date with a time of zero. It reads 08/08/2012T00:00:00. So I changed the default field value to the following function: translate(@UpdateDate[@Name = &amp;quot;Date Last Modified&amp;quot;], &amp;quot;T00:00:00&amp;quot;, &amp;quot;&amp;quot;) and that solves the issue.&lt;br /&gt;
&lt;br /&gt;
5. I then change my load event to read the contents of the text box thus circumventing the full trust error.&lt;br /&gt;
&lt;br /&gt;
Now the only issue I have is with my translate equation. For some reason instead of producing 08/08/2012 it is doing 212/8/8.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Edit: You have to change the permission settings to allow for reading of MSysObjects table</description></item><item><title>Re: Load Event Only Works in Preview</title><link>https://www.infopathdev.com:443/forums/thread/81509.aspx</link><pubDate>Wed, 08 Aug 2012 17:52:11 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:81509</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/81509.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=81509</wfw:commentRss><description>&lt;p&gt;Well, I&amp;#39;d try the query in Access first - My thought is that if you are actually copying a new DB file onto a machine, the create date may be the correct one. Not sure though.&lt;/p&gt;
&lt;p&gt;But then, you should be able to create a data connection in IP to Access, and select any table, and click the Edit SQL button, and replace with this.&lt;/p&gt;</description></item><item><title>Re: Load Event Only Works in Preview</title><link>https://www.infopathdev.com:443/forums/thread/81508.aspx</link><pubDate>Wed, 08 Aug 2012 17:45:27 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:81508</guid><dc:creator>shep123</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/81508.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=81508</wfw:commentRss><description>Yes Hilary you are referring to the correct one. Where should I put that SQL statement? Is this being done within access or infopath? I&amp;#39;ve never used MSysObjects so this is a bit unfamiliar territory. Since I am doing date modified I assume I&amp;#39;d change DateCreate to DateLastModified.</description></item><item><title>Re: Load Event Only Works in Preview</title><link>https://www.infopathdev.com:443/forums/thread/81506.aspx</link><pubDate>Wed, 08 Aug 2012 17:05:51 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:81506</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/81506.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=81506</wfw:commentRss><description>&lt;p&gt;There is a DateCreate in the MSysObjects table - the entire DB file is being replaced / updated on a certain basis, do I remember your other questions correctly?&lt;/p&gt;
&lt;p&gt;So, if the whole DB is being replaced, I wonder if something like this:&lt;/p&gt;
&lt;p&gt;SELECT distinct CDate(Int(DateCreate)) AS CreateDate&lt;br /&gt;FROM MSysObjects&lt;/p&gt;
&lt;p&gt;Would work? I&amp;#39;m converting to Int then back to date to remove the time....&lt;/p&gt;</description></item><item><title>Re: Load Event Only Works in Preview</title><link>https://www.infopathdev.com:443/forums/thread/81505.aspx</link><pubDate>Wed, 08 Aug 2012 16:52:28 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:81505</guid><dc:creator>shep123</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/81505.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=81505</wfw:commentRss><description>I&amp;#39;ve discovered that it&amp;#39;s because my form is not full trust. The only problem with that discovery is that it requires too much work to get the certificate to allow for full trust (you just have to believe me on that). Is there a way I can use the edit SQL in my data connection to have it display date last modified? It doesn&amp;#39;t seem like that would work. However, this is a feature I would really prefer to have in the program and I&amp;#39;m stumped on what I could do to get around the full trust issue.</description></item><item><title>Re: Load Event Only Works in Preview</title><link>https://www.infopathdev.com:443/forums/thread/81501.aspx</link><pubDate>Wed, 08 Aug 2012 12:09:41 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:81501</guid><dc:creator>shep123</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/81501.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=81501</wfw:commentRss><description>Anyone have any ideas?</description></item><item><title>Load Event Only Works in Preview</title><link>https://www.infopathdev.com:443/forums/thread/81389.aspx</link><pubDate>Mon, 06 Aug 2012 12:57:51 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:81389</guid><dc:creator>shep123</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/81389.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=81389</wfw:commentRss><description>I have created a load event within InfoPath using vbs. My issue is that the code executes fine when I open it in preview mode from the design window. However, I attempt to fill out the form, as the users will, the event does not occur. I don&amp;#39;t know if it is worth noting, but when I preview the form I get a dialog box that says &amp;quot;An ActiveX control on this page might be unsafe to interact with other parts of the page. Do you want to allow this interaction?&amp;quot; I select yes and my code executes properly. Could this possibly be a full trust issue? For reference I included my code below. Any help appreciated.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
Sub XDocument_OnLoad(eventObj) &lt;br /&gt;
&amp;#39; Write your code here      &lt;br /&gt;
	Dim fso       &lt;br /&gt;
        Dim strFilename &lt;br /&gt;
	Dim context &lt;br /&gt;
	Dim findFile &lt;br /&gt;
	Dim lastModified &lt;br /&gt;
	Dim date2 &lt;br /&gt;
	&lt;br /&gt;
    strFilename = &amp;quot;D:\Data\QRF\Mannual Database.mdb&amp;quot; &lt;br /&gt;
		&lt;br /&gt;
    &amp;#39;This creates an instance of the MS Scripting Runtime FileSystemObject class &lt;br /&gt;
    Set fso = CreateObject(&amp;quot;Scripting.FileSystemObject&amp;quot;) &lt;br /&gt;
	Set findFile = fso.GetFile(strFileName) &lt;br /&gt;
	lastModified = findFile.DateLastModified  &lt;br /&gt;
	&lt;br /&gt;
	Set fso = Nothing &lt;br /&gt;
	date2 = Now &lt;br /&gt;
	&lt;br /&gt; 
	If DateDiff(&amp;quot;q&amp;quot;, lastModified, date2) &amp;gt; 0 Then &lt;br /&gt;
	x = MsgBox(&amp;quot;You have an outdated database stored on your computer. Please close the form and download the newest database.&amp;quot;, 0, &amp;quot;Outdated Database&amp;quot;) &lt;br /&gt;
	&amp;#39;Application.ActiveWindow.Close() &lt;br /&gt;
	End If &lt;br /&gt;
&lt;br /&gt;
XDocument.DOM.selectSingleNode(&amp;quot;/my:myFields/my:timestampDatabase&amp;quot;).text = lastModified	&lt;br /&gt;
	&lt;br /&gt;
End Sub



&lt;/code&gt;</description></item></channel></rss>