|
Question : Finding Null in a memo field and what event to use to check the related box
|
|
First of all sorry for all the posts lately but I am in the finishing stages of my database for work and am trying to clean up and streamline this system as much as possible, so basically all the tough problems I have been saving up are hitting me now so expect more to come. *winks*
Problem
I have a form with 4 buttons & 4 related memo fields
-When Button 1 is selected it marks in the table that this item is a factor (check=-1) -When Button 1 is selected it toggles off memo fields 2, 3, and 4 (which are all stacked on top of each other to save space) and focuses on the memo field 1
Problem: I would like the person using the form to be able to just enter the memo field and have it automatically update the check box to -1, BUT the problem lies in that if I place the event OnChange then it doesnt check if they erase the info and change their minds.
Basically where should I add the "check for null change check box" code. Because there are four the code breaks down OnOpen and doesnt work OnClose and having the code built into to the Memo Field OnChange works but OnExit or LostFocus doesnt work. Im baffled.
The code for each is very simple:
'Private Sub TestBox_Change()
'If [TextBox.Value] = Null Then 'TestingRqd.Value = 0 'Else 'TestingRqd.Value = -1 'End If
'End Sub
I basically put 4 of those in line one after the other. I was thinking the code break might be fixed if I move the 'end ifs' after all four run.
End if End if End if End if
...at the end of the four codes...or try to consolidate the If statement.
Honestly it would be nice to just hide or eliminate the checkboxes (these are controls to 4 yes/no fields in the table) altogether as I have buttons that let them toggle through the Memo fields and so they are a bit duplicative. So if I can set the properties in the query/table based on the memo fields being null or not null by working this code out effectively then I can probably eliminate them, but for now there's no way to effectively check the field for null on exit.
|
|
Answer : Finding Null in a memo field and what event to use to check the related box
|
|
Personally, I'd do that in the AfterUpdate event. It's like the OnChange but only fires once - when you leave the field. So when you leave the field check to see it's null: if isnull(me.memo1) then 'checkbox off else ' checkbox on end if
make sense? Walt
|
|
|
|