Clear bound control

  • Thread starter Thread starter Gary P via AccessMonster.com
  • Start date Start date
G

Gary P via AccessMonster.com

I have a text box which control source is bound to a calendar subform,
=frmCalendar.Form!Date_Cat, this then filters a query by date, I would like
to clear this text box date so the query will return all dates, I have tried
me.textbox=null but i get a VB error message which says you cant assign a
value to this object, this makes sense but how can i clear this text box.

Regards Gary.
 
Gary,

I am not sure if it possible for the "calendar subform" to have no
value, but if so, this would be an option.

However, clearing the textbox will probably not have the desired effect
anyway. If you are referencing the value of this textbox in the
criteria of the query, then the textbox being blank will not necessarily
mean the query will return all records.

Here's an idea... Instead of a command button or whatever in an attempt
to clear the textbox, put a (probably unbound) checkbox on the form,
labelled 'Show All', so the idea is that the query will return records
matching the date in the textbox, or, if the checkbox is ticked, all
records. You can therefore write the criteria into your query like this.
[Forms]![YourForm]![Textbox] Or [Forms]![YourForm]![Checkbox]=-1
 
Back
Top