2017-02-06 12 views
0

誰でも助けてくれる 私はMS Access 2013 とSharepoint online(office 365)を持っており、プライムデータベースSQLからSPオンラインにデータを取り込む必要があります。それはマニュアルであり、私は一晩中自動的にそれを必要としています。 そして、私はこれらがコードされているMS VB を使用します。私は、Windowsでこれを行っているマイクロソフトのアクセスビジュアルベーシックオートメーション毎晩

Option Compare Database 

Private Sub DeleteAdd_Click() 

    On Error Resume Next 

    DoCmd.SetWarnings False 
    DoCmd.OpenQuery "DeleteTest", acViewNormal, acEdit 
    DoCmd.SetWarnings True 
    DoCmd.SetWarnings False 
    DoCmd.OpenQuery "AddTest", acViewNormal, acEdit 
    DoCmd.SetWarnings True 

End Sub 

Private Sub lisACTORS_Click() 

    MsgBox lisACTORS.Value 
End Sub 

とにかく、私はVBやタスクのスケジュール

+0

たとえば、1時間ごとにチェックを入れ、時が真夜中と等しいかどうかを確認してから、コードを実行するタイマーを試すことができます。 – obl

+0

どうすればいいですか? – Ace

答えて

1

でそれを行うことができますが、前にフォームアプリケーション、私はわからないんだけど実行しているアプリケーションのタイプ。タイマーコントロールを追加し、タイマーを有効にして、タイマー間隔を60 * 1000 = 60000(1時間に相当)に設定します。そして、Timer.Tickイベント(https://msdn.microsoft.com/en-us/library/system.windows.forms.timer.tick(v=vs.110).aspx)で、書き込み:私は、私は数年前に持っていたかつての仕事でこれを行うために使用される

If Now.Hour.ToString = "23" Then 'Checks if the current hour is midnight 
    'Execute code 
End If 
+0

ありがとうObl、私は、クエリを追加した後、私はこれらの2つのクエリを夜間に実行する必要があります削除クエリがあります – Ace

+0

私は 'Execute code'をどこに配置すると、クエリを削除してクエリを追加します。そうすれば、その2つのことはいつか午前12時から午前1時の間に起こります。また、これを動作させるにはプログラムを実行しておく必要があります。私があなたの質問に答えたなら、私はあなたを答えとしてマークすることを感謝します、ありがとう。 – obl

+0

ありがとうObl、私は試してみて、私はまだ私と一緒に働いていない成功 – Ace

0

。次の手順を実行します 。 。 。

Create an AutoExec macro 

If you have already created a macro that contains the actions that you want to occur when the database starts, just rename the macro AutoExec, and it will run the next time that you open the database. Otherwise, follow these steps to create a macro: 

    On the Create tab, in the Other group, click Macro. If this command is unavailable, click the arrow beneath either the Module or the Class Module button, and then click Macro. 

    In the Macro Builder, in the first empty Action cell, select the action that you want to perform. If applicable, under Action Arguments, type the appropriate values in the argument boxes. 

    If you cannot find the action you want, on the Design tab, in the Show/Hide group, make sure Show All Actions is selected. This expands the list of actions that you can use, but the list will include some actions that will only run if the database is granted trusted status. For more information, see the articles Decide whether to trust a database or How database objects behave when trusted and untrusted. 

    Repeat step 2 for each additional action you want to occur. 

    Click Save, and in the Save As dialog box, type AutoExec. 

    Click OK and then close the Macro Builder. The new macro will run the next time that you open the database. 

すべてを起動するには、Windowsタスクスケジューラを使用する必要があります。すべての詳細については、下のリンクを参照してください。

https://www.sevenforums.com/tutorials/11949-elevated-program-shortcut-without-uac-prompt-create.html

あなたはこのプロセスに関する追加の質問がある場合はポストバック。

関連する問題