unknown behavior with text box values.

  • Thread starter Thread starter ragsman via AccessMonster.com
  • Start date Start date
R

ragsman via AccessMonster.com

Hi,
I've found a bug in an existing database that I don't know how to fix. Here's
the code on the afterupdate event for a text box that does a search for the
value typed into the text box [wo_selected]

Me![SECTION] = ""
Me![desc_selected] = ""
Me![date_selected] = ""
Forms![frm_SEARCH_TOOL_PROC].RecordSource = "tbl_DATA"
DoCmd.ApplyFilter "fltr_WO_PROC"

If IsNull([WORK_ORDER_NO]) Then
MsgBox ("Nothing found that matches that criteria. Try a narrower search.")
Forms![frm_SEARCH_TOOL_PROC].RecordSource = "tbl_data"
DoCmd.ApplyFilter "fltr_empty"
Me![wo_selected] = ""
Me.wo_selected.SetFocus

Exit Sub
End If

If no values are found initially the If statement works, the message box
shows, and everything is reset with nothing in the text box [wo_selected].
If a value is found, all matching records are shown, and the search criteria
remains in the textbox highlighted. good so far.
After that (if values WERE found on the first attempt), THEN no values are
found on the next attempt, the messagebox shows, the VALUE of the text box is
now null, however the search text remains in the text box [wo_selected]
highlighted. If i manually delete this text (one click of the delete key or
start typing new criteria), everything continues to work, however if I hit
enter without manually deleting the search text, it locks up with no error
message.
I don't understand why the text remains in the box highlighted, yet the text
box value seems to be null (no value). It may have something to do with the
two filters interacting, but I don't know why the typed text in the text box
won't disappear if set to "".
Is there a VB command that I could use to force the same action as hitting
the delete key?

thanks,
Mark
 
UPDATE.

I just realized that the function IS working, but in the case I described at
the end the cursor is blinking in the text box but the old data is just left
in there highted but doesn't mean anything (no value) until something else is
typed as well. Does that make sense? hitting enter again is like hitting
enter without anything entered in the text box.

I can start typing and 'add to' what's already in there, and it sees all of
it again.

help!

Hi,
I've found a bug in an existing database that I don't know how to fix. Here's
the code on the afterupdate event for a text box that does a search for the
value typed into the text box [wo_selected]

Me![SECTION] = ""
Me![desc_selected] = ""
Me![date_selected] = ""
Forms![frm_SEARCH_TOOL_PROC].RecordSource = "tbl_DATA"
DoCmd.ApplyFilter "fltr_WO_PROC"

If IsNull([WORK_ORDER_NO]) Then
MsgBox ("Nothing found that matches that criteria. Try a narrower search.")
Forms![frm_SEARCH_TOOL_PROC].RecordSource = "tbl_data"
DoCmd.ApplyFilter "fltr_empty"
Me![wo_selected] = ""
Me.wo_selected.SetFocus

Exit Sub
End If

If no values are found initially the If statement works, the message box
shows, and everything is reset with nothing in the text box [wo_selected].
If a value is found, all matching records are shown, and the search criteria
remains in the textbox highlighted. good so far.
After that (if values WERE found on the first attempt), THEN no values are
found on the next attempt, the messagebox shows, the VALUE of the text box is
now null, however the search text remains in the text box [wo_selected]
highlighted. If i manually delete this text (one click of the delete key or
start typing new criteria), everything continues to work, however if I hit
enter without manually deleting the search text, it locks up with no error
message.
I don't understand why the text remains in the box highlighted, yet the text
box value seems to be null (no value). It may have something to do with the
two filters interacting, but I don't know why the typed text in the text box
won't disappear if set to "".
Is there a VB command that I could use to force the same action as hitting
the delete key?

thanks,
Mark
 
Back
Top