Access VBA Macro Programming

(Joao Candeias) #1
half-drawn on the screen, which looks untidy to the user. Doing aRepaintbefore the process
is run tidies the form up.

Me.Repaint

Requery
TheRequerymethod re-queries the form and updates all the controls accordingly. In a
multiuser environment, another user could have changed data in a table that affects the form
that the current user is viewing. The current user will be viewing stale data unless a Requery
takes place.

Me.Requery

RibbonName
RibbonNameholds the name of the ribbon specific to that form or report. If it is empty, then
the default ribbon is displayed. Chapter 11 discusses how to create custom ribbons in Access.

Me.RibbonName = "MyNewRibbon"

ScrollBars
TheScrollbarsproperty dictates how the form will show scroll bars. It takes the following
values:

Value Setting
0 No scroll bars
1 Horizontal only
2 Vertical only
3 Both

Me.ScrollBars = 2

This code will put a vertical scroll bar on the form.

SetFocus
This method sets the focus on the form or report. The focus may have been on a control on
the form or report or on another form or report.

Me,SetFocus

Undo
TheUndomethod allows you to give the user an option not to save their changes. If the code
is placed in theForm_BeforeUpdateevent (see Chapter 9 for more information on forms),

204 Microsoft Access 2010 VBA Macro Programming

Free download pdf