Search empty field

  • Thread starter Thread starter Zaradi Zakaria
  • Start date Start date
Z

Zaradi Zakaria

Hi,

Thanks for organizing this great web forum, hope this will settle my problem.
I've created a form with search command button with code;
Me.Filter = "[YourFieldName]='" & YourFilterValue & "'"
Me.FilterOn = True

Normally I use this code to search any value in 'YourFieldName'. It's work
fine unless if you trying to use for empty field. When I use the field to
put value =Now() contains Date&Time format ,sadly my search button does'nt
work to search for any empty value in that field. I''ve tried Is Null/Null/ "
" but it still does'nt work.

Second, how can I lock value from overwriten by new value. I've use command
button to update new date. But I do'nt want user to overwrite with previous
value(date).

So any suggestions appreciated.


Thanks in advance.

Eddy
 
First, if your field contains a date/time format, your filter should look
like this:
Me.Filter = "[YourFieldName]=#" & YourFilterValue & "#"

To include a null search (assuming YourFilterValue is a string), you might
have to code something like this:
If YourFilterValue="" then
Me.Filter = "[YourFieldName] Is Null"
Else
Me.Filter = "[YourFieldName]=#" & YourFilterValue & "#"
EndIf

As for locking, you can set your textbox's Locked property to Yes.
You'll still be able to change the value programmatically, but the user
won't be able to type directly into the field.

HTH
 

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

Back
Top