clearing the contents displayed in controls on a form

K

Karen

I have a form with a query as the record source. The form has a
control (entercode) in the form header that is used as a seach field.
The user enters a code in the control and clicks a button to find that
code in the query.

I'd like to have all of the controls in the details section of the
form go blank when the user clicks in the entercode control again. I
don't want to delete anything from the tables, just make the controls
blank like they are when the form opens.

anyone have any ideas for me?

Karen S
 
S

strive4peace

Hi Karen,

'~~~~~~~~~~~
'find the first value that matches

'-------------------- CHOOSE ONE
'if search control is numeric
Me.RecordsetClone.FindFirst "Field = " & me.SearchControlname

'if search control is text
Me.RecordsetClone.FindFirst "Field = '" & me.SearchControlname & "'"
'--------------------

'if a matching record was found, then move to it
'otherwise, go to a new record
If Not Me.RecordsetClone.NoMatch Then
Me.Bookmark = Me.RecordsetClone.Bookmark
else
docmd.runcommand acCmdRecordsGoToNew
'set control value if desired
me.controlname = me.SearchControlname
End If
'~~~~~~~~~~~


Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top