Sunday, June 14, 2015

Dynamic Formatting of Forms

GetFocus, Resize, Color Data

Here is a description about how to perform three different actions on forms to respond to data entries or changes in events.
Eventful Formatting for Access Forms
By Rick Dobson - SmartAccess magazine

Formatting with GotFocus and LostFocus events
One of the most visually dramatic changes that you can make to a form involves changing the image that tiles across the background of a form.
Formatting with the Resize event
Since the inception of Access, form designers have been plagued by the ability of users to change the size and shape of a form. This is because controls on a form maintain their size and anchor their position to the form's top and left borders even while a form changes its size, shape, or both. Whenever a user changes the size or shape of a form, the form's Resize event fires.
Formatting Data
"It's typical for designers to need to dynamically alter formatting to reflect the value in a textbox or other controls. Here's an example of why it's important to understand how the Access events work. With the Current event:
  • You can change the formatting whenever the user moves to a new record in the record source for a form.
  • You can change formatting when a form initially loads data for display.
  • However, the Current event doesn't fire when a user changes a value on the current row, so you can't use this event to respond to user input.
To respond to user-entered data, you can use the AfterUpdate event for a control to change the formatting for the value in a control after updating. While the Current event applies to a form overall, you can create an AfterUpdate event procedure for a whole form or a specific control on a form."
Look for a demo file called "502DOBSON.ZIP" (The image file in the code resides in the articles folder of the c:\ path. You'll probably need to update the path for the image files on your computer.)

Also see: Access  
Colors and Continuous forms  
Changing the Background Color of the Current Record

See all Topics

No comments: