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

Residual Data problem when creating a new record

Status
Not open for further replies.

webmonkey2u

Programmer
Jan 2, 2003
1
ZA
I have a Main form that opens another form and filters the second form to get the main records related subrecords to display only in that second form. the filter is done via VBA code and openform btn.

Problem I have is that when creating a new entry in the second form, the second forms subforms have residual data from the previous related record entries.

I am willing to send anyone the MDB file as it is very small so you can help me PLEASE.

Thanks all
 
Why don't you have a function like below that clears all the controls of their old values (This function assumes that all your controls are 'properly' prefixed - i.e. txt for text box, cbo for combo box, lst for list box...)
Code:
Function fncClearControls
Dim ctrl As Control

For each ctrl in Me.Controls
    If left(ctrl.Name,3) = "txt" then
        Me.Controls(ctrl.Name).Value = Null
    Endif 

    If left(ctrl.Name,3) = "cbo" or left(ctrl.Name,3) = "lst" Then
        Me.Controls(ctrl.Name).RowSource = ""
    Endif

Next

End Function

Hope this helps!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top