Clear Button for unbound fields

LWCARAB

Registered User.
Local time
Today, 23:41
Joined
Jan 29, 2008
Messages
38
Any ideas why this code isn't working?

Private Sub cmdClear_Click()
'cancel the filter and clear all the search criteria objects
FilterOn = False
qtitle = Null
qauthor = Null
qissue = Null
qjournal = Null
qsubject = Null
qsubject2 = Null
End Sub

It's from an already existing database in which is worked but here, I press the button and nothing happens.

Richard
 
Have you used the debugger to see if the code is even being executed? Maybe the name of the command button is no longer cmdClear, or maybe the [Event Procedure] is no longer in the On Click event of the button.
 
Hi

you could do this-

qtitle.value = ""
qauthor.value = ""
qissue.value = ""
qjournal.value = ""
qsubject.value = ""
qsubject2.value = ""

if the items are fields on the form. that would clear them.

NS
 
Already tries .value="" but same thing, nothing happens, fields stay completed
 
Hi

are the default values set to another forms value? there must be someting going on for the values to stick. are the items on the form locked for non editing? this might prevent the changes happening.

NS
 
4 are drop down boxes betting data from a table, and one is a free hand text box. They are not locked
 
HI,

just a thought.

if 4 are dropdown boxes, then isnt the data being provided by a statement or query? you must have a control source dictating where the information is coming from. on a textbox, the info can come from a table or if the box is unbound, is just restricted to the form so the data can be easily erased but if there was something behind the scenes ( a statement forcing information ), wouldn't that overrule the clearing of the boxes?

as for the freehand text box. what provides the data? is it manually entered or supplied?

NS
 
All the dropdown boxes get data from a talbe with a row source like the following:

SELECT [JOURNAL] FROM JOURNALS;

The text box is manually entered.
all this is exactly the same in the database I took the code from (where it works), even the field names

Richard
 
Have you used the debugger to see if the code is even being executed? Maybe the name of the command button is no longer cmdClear, or maybe the [Event Procedure] is no longer in the On Click event of the button.
 
can you post the database where you got the detail from?
 
Have you used the debugger to see if the code is even being executed? Maybe the name of the command button is no longer cmdClear, or maybe the [Event Procedure] is no longer in the On Click event of the button.
I really think this could be the problem. It has happened to me many times.
 
Yeah,

that is so easy to do. its also happened to me many times.
 
Here is the database and the problem code is in the search form. I've had to remove the data to meet company regulations
 

Attachments

You were right, the was no event on click, what a stupid mistake, Thanks
 
i did notice that straight away on opening your Db. hopefully, it works now and thanks to GolferGuy for that :)

FORE!!
 
You are welcome. By the way, I hope that is not a stupid mistake, I've done it too many times! :o
 

Users who are viewing this thread

Back
Top Bottom