Access VBA Macro Programming

(Joao Candeias) #1

Filter


TheFilterproperty returns the filter that is being used on the form:


MsgBox Me.Filter


It can also be used to set the filter on the form:

Me.Filter = "MyField> 4 "


Hwnd


Hwndreturns the handle for the window of the form or report. It is useful if using API calls
within the module for the form or report since some API calls require this as a parameter. See
Chapter 20 for more information on API calls.


MsgBox Me.Hwnd


Picture


ThePictureproperty allows you to manipulate the background picture on the form or report:


Me.Picture = "C:\Users\Richard\Pictures\MyPicture.jpg"


Once loaded, the picture becomes part of the form or report and does not rely on the path.


Printer


You can access, and in some cases change, the properties for the printer device for the form
or report. The following code will provide the printer name for the active form or report.


MsgBox Me.Printer.DeviceName


RecordSource


TheRecordSourceproperty will provide the record source that is bound to the form or
report, such as a table or query.


MsgBox Me.RecordSource


Refresh


TheRefreshmethod updates the underlying records of a form immediately so as to enact any
changes the user has made.


Me.Refresh


Repaint


TheRepaintmethod is used to complete any pending screen updates and recalculations
on a form. Sometimes if there is a long-running process on the form, the form can be left


Chapter 15: The Main Objects 203

Free download pdf