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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clear Form without Deleting Data 1

Status
Not open for further replies.

bigz60

Technical User
Apr 18, 2007
40
US
Hello. I have a form that is used to enter data. I would also like to use this form to enable the user to dynamically query the data.

For example, if the user wanted to find every customer in New Orleans, the user would click the "clear" button, and the form would clear, and then in the City Text Field the would enter "New Orleans" and then click the "find" button.

I have found the coding necessary to clear the form, but when the form is cleared, it is actually deleting that row of data from the tables.

Below is the code that I am currently using:

Code:
Private Sub cmdClear_Click()
    Dim I As Integer
    
    ' Cycle through the form's controls, testing for text,
    ' and clear each field.
    For I = 0 To Me.Count - 1
    If TypeOf Me(I) Is TextBox Then
      Me(I) = " "
    ElseIf TypeOf Me(I) Is ComboBox Then
      Me(I) = " "
    End If
    Next

End Sub
 
I'd don't use a bound form as search form.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 

You could create a "dummy" form.
Go to the dummy form instead of deleting the data.


Randy
 
Thank you all for your input. Bubba, I took a look at the link you posted, and that looks to be exactly what I am trying to do. I will use that as the base and modify as needed.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top