Clearing subform datasheet

M

Michael Wong

I have a subform in datasheet view that I fill with the following code:

MySubform.Form.RecordSource = "SELECT..."

But how do I clear the datasheet? Used to do it with .Clear() in ADO.NET

Thanks in advance for any help.
 
A

Allen Browne

You could clear the subform with:
MySubform.Form.RecordSource = "SELECT... WHERE (False);"

However, subforms are most commonly used to show the related data for the
record in the main form. If you set the LinkMasterFields/LinkChildFields of
the subform control, all this happens automatically.
 
M

Michael Wong

Thank you for your reply.
I think this is what I need, just need to implement it.
In fact, what I do is having a text box where the user enter a word he wants
to look for and have the list displayed in the subform. But when the text
box is empty than I want the subform to display nothing instead of every
records, which could be a little bit slow on a network connection.
 

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