Hi,
My query is:
On clicking the button i get a form where i can enter the text in text fields namely, HEADER, NOTES and FOOTER.
The entered data is saved. But when i open the fresh form, the previously enterd data will be displayed. Could you please help me in making the fields cleared on second open?

Thanks in advance
Ramesh Sagar

Recommended Answers

All 3 Replies

Add the following code to a module (.bas) -

Public Sub ClearTextBoxes(frm As Form)

Dim Control As Control

 For Each Control In frm.Controls
        If TypeOf Control Is TextBox Then
            Control.Text = vbNullString
        End If

    Next Control
End Sub

Now, in your Form 2 under form unload event -

Private Sub Form_Unload(Cancel As Integer)
 Call ClearTextBoxes (Me)
End Sub

Hi Andre,
Thanks for your peplie which has thrashed me, cuz i
was out of topic.

? not sure what you are reffering to Irina? :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.