Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I refresh the forms with List Box unselected Again 1

Status
Not open for further replies.

dippy83

Technical User
Feb 11, 2008
3
US
I have bunch of list boxes that a user can select to pull raw data out using the command button that opens up the query based on the list criteria. I need to deslect all the selections so it's as if someone just opened the form. Basically refresh the form. How do I do that?
 
This is from vba help

Access Developer Reference
Form.Dirty Property
You can use the Dirty property to determine whether the current record has been modified since it was last saved. Read/write Boolean.
Syntax

expression.Dirty

expression A variable that represents a Form object.

Remarks


For example, you may want to ask the user whether changes to a record were intended and, if not, allow the user to move to the next record without saving the changes.

When a record is saved, Microsoft Access sets the Dirty property to False. When a user makes changes to a record, the property is set to True.


Example


The following example enables the btnUndo button when data is changed. The UndoEdits( ) subroutine is called from the AfterUpdate event of text box controls. Clicking the enabled btnUndo button restores the original value of the control by using the OldValue property.

Visual Basic for Applications
Sub UndoEdits()
If Me.Dirty Then
Me!btnUndo.Enabled = True ' Enable button.
Else
Me!btnUndo.Enabled = False ' Disable button.
End If
End Sub

Sub btnUndo_Click()
Dim ctlC As Control
' For each control.
For Each ctlC in Me.Controls
If ctlC.ControlType = acTextBox Then
' Restore Old Value.
ctlC.Value = ctlC.OldValue
End If
Next ctlC
End Sub

This may be what you are looking for

ck1999
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top