Selasa, 24 Desember 2013

Re: [belajar-access] Scroll di Ms Access 2007

 


Budhi Prasetyo...,


1. Coba buat modul baru. Isi dengan script seperti dibawah ini:

Public Function DoMouseWheel(frm As Form, lngCount As Long) As Integer
On Error GoTo Err_Handler
    'Purpose:   Make the MouseWheel scroll in Form View in Access 2007.
    '           This code lets Access 2007 behave like older versions.
    'Return:    1 if moved forward a record, -1 if moved back a record, 0 if not moved.
    'Author:    Allen Browne, February 2007.
    'Usage:     In the MouseWheel event procedure of the form:
    '               Call DoMouseWheel(Me, Count)
    Dim strMsg As String
    'Run this only in Access 2007 and later, and only in Form view.
    If (Val(SysCmd(acSysCmdAccessVer)) >= 12#) And (frm.CurrentView = 1) And (lngCount <> 0&) Then
        'Save any edits before moving record.
        RunCommand acCmdSaveRecord
        'Move back a record if Count is negative, otherwise forward.
        RunCommand IIf(lngCount < 0&, acCmdRecordsGoToPrevious, acCmdRecordsGoToNext)
        DoMouseWheel = Sgn(lngCount)
    End If

Exit_Handler:
    Exit Function

Err_Handler:
    Select Case Err.Number
    Case 2046&                 'Can't move before first, after last, etc.
        Beep
    Case 3314&, 2101&, 2115&   'Can't save the current record.
        strMsg = "Cannot scroll to another record, as this one can't be saved."
        MsgBox strMsg, vbInformation, "Cannot scroll"
    Case Else
        strMsg = "Error " & Err.Number & ": " & Err.Description
        MsgBox strMsg, vbInformation, "Cannot scroll"
    End Select
    Resume Exit_Handler
End Function

2. Design form yang akan dieksekusi. Klik kanan pojok atas ==> pilih properties. Arahkan pada event On Mouse Whell ==> klik seperti gambar dibawah ini.

http://localhost/img_art/scrol_0.jpg

Lalu, beri event seperti ini:

Call DoMouseWheel(Me, Count)

Sehingga hasilnya akan menjadi:

http://localhost/img_art/scrol_1.jpg

Semoga bisa membantu dan memberi semangat.

Hariyanto (Surabaya)






On Tuesday, 24 December 2013, 10:15, Budhi Prasetyo <budhi.prasetyo@gmail.com> wrote:
 
Selamat pagi para Pakar Access,

Di aplikasi yg saya buat menggunakan Access 2000, pada form input data, tombol scroll di mouse bisa digunakan untuk berpindah record,
Di Access 2007 tidak bisa, mohon solusinya.

Terima kasih untuk pencerahannya.

Salam,
Budhi Prasetyo


__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)
Recent Activity:
SPAM IS PROHIBITED
.

__,_._,___

Tidak ada komentar:

Posting Komentar