A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Need to clear controls of Filter form



 
 
Thread Tools Display Modes
  #1  
Old November 27th, 2004, 04:24 PM
Jan Il
external usenet poster
 
Posts: n/a
Default Need to clear controls of Filter form

Hi all - Access 2002 XP, W2K :-)

I have a small question regarding clearing controls on a form.

How, or where, can I add a bit of code, perhaps on a Filter form, or Record
form, to make sure all the combo boxes and text boxes on the Filter form are
automatically cleared of the previous entries and ready for the next one?

I have tried to put this in the On Open event of the Filter form, so that
when the form is opened again upon returning from the Record form, it will
open the Filter form with no lingering entries in any of the boxes. I have
also tried it in the Filter form Events as well, however, when the Filter
form is opened upon return from the Record form all previous entries are
still in the boxes. I have several types of methods and codes in similar
forms and they work fine, but, for some reason, none want to work in this
form.

One method I have is Me![Combo94] = Null in the Command button code for
each control. Another method I've used before is in the Forms On Activate
event:

Private Sub Form_Activate()

Me![Text0] = Null
Me![Text9] = Null
Me![Combo99] = Null
Me![Combo121] = Null
Me![Text109] = Null

End Sub


However, if I close the current Filter form with the Exit button (a text box
on the Filter form with a Macro to Close the Filter form and Open the main
form, and then reopen the Filter form from the main form the boxes are all
clear. But, not when I go from the Filter form to the Record form and back
to the Filter form. I also now have the Default for the boxes all set to
Null, but, they are still coming back with the entries.

The method that I use to return from the Record form is also an Exit
button/tab, which is a text box with a Macro that Closes the Record form and
Opens the Filter form. I don't fully understand why the entries will clear
when exiting from the Filter form to the main form, or upon opening from the
main form, and yet, will not clear going to or from the Record form, with
all using the Exit button navigation.

I'd really appreciate any suggestions as to which method might work best in
which form or control. I'm totally out of ideas at this point, as what has
worked before is not working now.


Jan
Smiles are meant to be shared,
that's why they're so contagious.


  #2  
Old November 28th, 2004, 12:22 AM
Jan Il
external usenet poster
 
Posts: n/a
Default

The problem has been resolved using the following method:

Private Sub Form_Activate()
Me.cmbDBTExpense.Value = ""
Me.cmbCheckNo.Value = ""
Me.cmbExpense.Value = ""
Me.cmbPaidTo.Value = ""
Me.TxtDate1.Value = ""
Me.TxtDate2.Value = ""

End Sub

Jan
Smiles are meant to be shared,
that's why they're so contagious.



"Jan Il" wrote in message
...
Hi all - Access 2002 XP, W2K :-)

I have a small question regarding clearing controls on a form.

How, or where, can I add a bit of code, perhaps on a Filter form, or

Record
form, to make sure all the combo boxes and text boxes on the Filter form

are
automatically cleared of the previous entries and ready for the next one?

I have tried to put this in the On Open event of the Filter form, so that
when the form is opened again upon returning from the Record form, it will
open the Filter form with no lingering entries in any of the boxes. I

have
also tried it in the Filter form Events as well, however, when the Filter
form is opened upon return from the Record form all previous entries are
still in the boxes. I have several types of methods and codes in similar
forms and they work fine, but, for some reason, none want to work in this
form.

One method I have is Me![Combo94] = Null in the Command button code

for
each control. Another method I've used before is in the Forms On Activate
event:

Private Sub Form_Activate()

Me![Text0] = Null
Me![Text9] = Null
Me![Combo99] = Null
Me![Combo121] = Null
Me![Text109] = Null

End Sub


However, if I close the current Filter form with the Exit button (a text

box
on the Filter form with a Macro to Close the Filter form and Open the main
form, and then reopen the Filter form from the main form the boxes are all
clear. But, not when I go from the Filter form to the Record form and

back
to the Filter form. I also now have the Default for the boxes all set to
Null, but, they are still coming back with the entries.

The method that I use to return from the Record form is also an Exit
button/tab, which is a text box with a Macro that Closes the Record form

and
Opens the Filter form. I don't fully understand why the entries will

clear
when exiting from the Filter form to the main form, or upon opening from

the
main form, and yet, will not clear going to or from the Record form, with
all using the Exit button navigation.

I'd really appreciate any suggestions as to which method might work best

in
which form or control. I'm totally out of ideas at this point, as what

has
worked before is not working now.


Jan
Smiles are meant to be shared,
that's why they're so contagious.




  #3  
Old November 28th, 2004, 02:04 PM
Jeff Boyce
external usenet poster
 
Posts: n/a
Default

You may already be aware that a zero-length string (your "") and a Null
(nothing, no value) are not the same. For instance, if you insert zls ("")
into your txtDate2, then subsequently someone looks for rows where txtDate2
is Null, you won't find it!

--
Good luck

Jeff Boyce
Access MVP

"Jan Il" wrote in message
...
The problem has been resolved using the following method:

Private Sub Form_Activate()
Me.cmbDBTExpense.Value = ""
Me.cmbCheckNo.Value = ""
Me.cmbExpense.Value = ""
Me.cmbPaidTo.Value = ""
Me.TxtDate1.Value = ""
Me.TxtDate2.Value = ""

End Sub

Jan
Smiles are meant to be shared,
that's why they're so contagious.



"Jan Il" wrote in message
...
Hi all - Access 2002 XP, W2K :-)

I have a small question regarding clearing controls on a form.

How, or where, can I add a bit of code, perhaps on a Filter form, or

Record
form, to make sure all the combo boxes and text boxes on the Filter form

are
automatically cleared of the previous entries and ready for the next

one?

I have tried to put this in the On Open event of the Filter form, so

that
when the form is opened again upon returning from the Record form, it

will
open the Filter form with no lingering entries in any of the boxes. I

have
also tried it in the Filter form Events as well, however, when the

Filter
form is opened upon return from the Record form all previous entries are
still in the boxes. I have several types of methods and codes in

similar
forms and they work fine, but, for some reason, none want to work in

this
form.

One method I have is Me![Combo94] = Null in the Command button code

for
each control. Another method I've used before is in the Forms On

Activate
event:

Private Sub Form_Activate()

Me![Text0] = Null
Me![Text9] = Null
Me![Combo99] = Null
Me![Combo121] = Null
Me![Text109] = Null

End Sub


However, if I close the current Filter form with the Exit button (a text

box
on the Filter form with a Macro to Close the Filter form and Open the

main
form, and then reopen the Filter form from the main form the boxes are

all
clear. But, not when I go from the Filter form to the Record form and

back
to the Filter form. I also now have the Default for the boxes all set

to
Null, but, they are still coming back with the entries.

The method that I use to return from the Record form is also an Exit
button/tab, which is a text box with a Macro that Closes the Record form

and
Opens the Filter form. I don't fully understand why the entries will

clear
when exiting from the Filter form to the main form, or upon opening from

the
main form, and yet, will not clear going to or from the Record form,

with
all using the Exit button navigation.

I'd really appreciate any suggestions as to which method might work best

in
which form or control. I'm totally out of ideas at this point, as what

has
worked before is not working now.


Jan
Smiles are meant to be shared,
that's why they're so contagious.





 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dates in a listbox connected to a form... RusCat Using Forms 13 November 25th, 2004 02:31 AM
Protect Document Clear Form Ryan Carlson General Discussion 3 July 23rd, 2004 06:31 PM
Bug: print preview in form datasheet with server filter on crashes access (ADP A2002 SP3) Eric Cárdenas [MSFT] Using Forms 4 June 24th, 2004 08:38 AM
Problem with "filter by form" Gary Walter Running & Setting Up Queries 0 June 18th, 2004 12:05 PM
Recordset in subform based on field in parent form Lyn General Discussion 15 June 14th, 2004 03:10 PM


All times are GMT +1. The time now is 05:17 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.