"Anne" <(E-Mail Removed)> wrote in message
news:271ca01c46358$e7570c10$(E-Mail Removed)
> Hi! I'm working on a database where I have one form,
> called "View Main Records", that houses the information
> itself. I also have a "Search Main Records" form that
> allows the user to search multiple fields and then the
> corresponding records come up from the "View Main Records"
> form.
> What I need is a way to refresh the "Search Main Records"
> form as soon as the results come up in "View Main
> Records." This would be some kind of VB code to clear the
> form so that after the user browses the results and closes
> the other form, s/he could begin a new search without
> having to close the search form. Right now I have
> Me.Refresh, but I still have to close the search form to
> start over. Any ideas?
From the sound of it, the "Search Main Records" form is unbound, since
it's just serving as a means of generating a filter for the "View Main
Records" form. Therefore, Refresh won't have any effect. I think you
could use code like this, possibly executed by a command button on the
form:
' *** WARNING: AIR CODE ***
Dim ctl As Access.Control
' Disable error-checking, to avoid errors with
' non-data controls.
On Error Resume Next
For Each ctl In Me.Controls
If Len(ctl.DefaultValue) > 0 Then
ctl.Value = Eval(ctl.DefaultValue)
Else
ctl.Value = Null
End If
Next ctl
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)