Senin, 01 Desember 2014

[belajar-access] Re: Refresh HTML dalam Access

 

Narupi...,


Bisa memakai modul untuk mengeksekusi F5. Misal:

Option Compare Database
Option Explicit

Private Declare Function GetModuleFileName Lib "Kernel32" Alias "GetModuleFileNameA" (ByVal hModule As Long, ByVal lpFileName As String, ByVal nSize As Long) As Long

'get os version
Private Type OSVERSIONINFO
  dwOSVersionInfoSize As Long
  dwMajorVersion As Long
  dwMinorVersion As Long
  dwBuildNumber As Long
  dwPlatformId As Long
  szCSDVersion As String * 128
End Type

Private Declare Function GetVersionEx Lib "kernel32.dll" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long


Public Sub Send_keys(Text$, Optional wait As Boolean = False)

    Static init As Boolean, IsIDEUnderVista As Boolean, WshShell As Object
   
    'wrapper for Sendkeys which does not cause an Error 70 in the IDE under Windows Vista/ 7
    'WshShell does not get set to Nothing before App ends but any problems related to that only happen in the IDE
    'Errors due to WScript disablement on the OS can only happen under the IDE
    'Extra overhead for the WshShell object is only required under the IDE

    'If Not init Then
    '    If IsDevEnv() Then
    '        IsIDEUnderVista = (OsVersion() >= 6)
    '        If IsIDEUnderVista Then Set WshShell = CreateObject("WScript.Shell")
    '    End If
    '    init = True
    'End If
   
    If Not IsIDEUnderVista Then
        VBA.SendKeys Text$, wait
    Else
        WshShell.SendKeys Text$, wait
    End If
   
End Sub

Public Function IsDevEnv() As Boolean

    Dim strFileName$
    Dim lngCount&
   
    strFileName = String(255, 0)
    lngCount = GetModuleFileName(Null, strFileName, 255&)
    strFileName = Left(strFileName, lngCount)
   
    IsDevEnv = (UCase(Right(strFileName, 7)) Like "VB?.EXE")

End Function

Function OsVersion() As Single
   
    Dim os As OSVERSIONINFO
    Dim RetVal As Long
    os.dwOSVersionInfoSize = Len(os)
    RetVal = GetVersionEx(os)  ' read Windows's version information
   
'    MsgBox "Windows version number:" & os.dwMajorVersion & Chr(Asc(".")) & os.dwMinorVersion
'    MsgBox "OS Version Info Size = " & os.dwOSVersionInfoSize
'    MsgBox "BuildNumber = " & os.dwBuildNumber
'    MsgBox "Platform ID = " & os.dwPlatformID 'Note If ID =0 win 3.x , ID=1 win9x and ID =2 WINNT
'    MsgBox "CSD Version = " & os.szCSDVersion
   
   
    OsVersion = Val(os.dwMajorVersion & "." & os.dwMinorVersion)

End Function


Cara menggunakannnya:

Send_keys "{F5}", True

Adapaun referensi send key sebagai berikut:

'=====================
'reference SendKeys
'=====================
'BACKSPACE ==> {BACKSPACE}, {BS}, or{BKSP}
'BREAK ==> {BREAK}
'CAPS LOCK ==> {CAPSLOCK}
'DEL or DELETE ==> {DELETE} or{DEL}
'DOWN ARROW ==> {DOWN}
'LEFT ARROW ==> {LEFT}
'RIGHT ARROW ==> {RIGHT}
'END ==> {END}
'ENTER ==> {ENTER} or ~
'ESC ==> {ESC}
'HELP ==> {HELP}
'HOME ==> {HOME}
'INS or INSERT ==> {INSERT} or {INS}
'NUM LOCK ==> {NUMLOCK}
'PAGE DOWN ==> {PGDN}
'PAGE UP ==> {PGUP}
'PRINT SCREEN ==> {PRTSC}
'SCROLL LOCK ==> {SCROLLLOCK}
'TAB ==> {TAB}
'UP ARROW ==> {UP}
'F1 ==> {F1}
'F2 ==> {F2}
'F3 ==> {F3}
'F4 ==> {F4}
'F5 ==> {F5}
'F6 ==> {F6}
'F7 ==> {F7}
'F8 ==> {F8}
'F9 ==> {F9}
'F10 ==> {F10}
'F11 ==> {F11}
'F12 ==> {F12}
'F13 ==> {F13}
'F14 ==> {F14}
'F15 ==> {F15}
'F16 ==> {F16}
'SHIFT ==> +
'CTRL ==> ^
'ALT ==> %

Semoga bisa membantu dan memberi semangat.


Hariyanto (Surabaya)

---In belajar-access@yahoogroups.com, <Narupi@infineon.com> wrote :

Dear Suhu Access,


Saya sedang membuat tampilan summary data dengan menggunakan web browser control.
Maksud saya adalah data saya export dulu ke dalam file berbentuk HTML kemudian data itu saya tampilkan dengan menggunakan web browser control
Semuanya berjalan bagus.
Tapi masalah saya adalah data itu tidak bisa saya refresh kecuali klick F5.
Saya sudah mencoba menggunakan code
Web.requery
Tapi masih belum suksess. Mohon bantuannya


Thanks and regards


Please consider the environment before printing this e-mail
 

__._,_.___

Posted by: har_i20002000@yahoo.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)
SPAM IS PROHIBITED

.

__,_._,___

Tidak ada komentar:

Posting Komentar