Require to clear all feilds in the form

V

vandy

I have a combo box which searches records in the table. When i type in a
record that is not in the database it prompts a message. The problem is once
I get the message then all the values in text boxes should become null and
clear out. how to do this. At present the values from the previous record is
getting displayed.

Private Sub CboMoveTo_AfterUpdate()
Dim rs As DAO.Recordset

If Not IsNull(Me.cboMoveTo) Then
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[ITEM_NO] = """ & Me.cboMoveTo & """"
If rs.NoMatch Then
MsgBox "DWG NO DOES NOT EXIST?"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub

thanks for your help in advance
 
V

vandy

Thanks for your response. I tried this statement but only the first text box
control gets cleared.

I used it here

If rs.NoMatch Then
me.undo
MsgBox "DWG NO DOES NOT EXIST?"

is there any other way i can clear all controls.

thanks for your time.

scubadiver said:
me.undo

will clear all fields

--

http://www.ready4mainstream.ny911truth.org/index.html


vandy said:
I have a combo box which searches records in the table. When i type in a
record that is not in the database it prompts a message. The problem is once
I get the message then all the values in text boxes should become null and
clear out. how to do this. At present the values from the previous record is
getting displayed.

Private Sub CboMoveTo_AfterUpdate()
Dim rs As DAO.Recordset

If Not IsNull(Me.cboMoveTo) Then
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[ITEM_NO] = """ & Me.cboMoveTo & """"
If rs.NoMatch Then
MsgBox "DWG NO DOES NOT EXIST?"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub

thanks for your help in advance
 
S

scubadiver

Apologies.

"Me" refers to the field itself.

Try

[forms]![form name].undo

instead. Educated guess.

--

http://www.ready4mainstream.ny911truth.org/index.html


vandy said:
Thanks for your response. I tried this statement but only the first text box
control gets cleared.

I used it here

If rs.NoMatch Then
me.undo
MsgBox "DWG NO DOES NOT EXIST?"

is there any other way i can clear all controls.

thanks for your time.

scubadiver said:
me.undo

will clear all fields

--

http://www.ready4mainstream.ny911truth.org/index.html


vandy said:
I have a combo box which searches records in the table. When i type in a
record that is not in the database it prompts a message. The problem is once
I get the message then all the values in text boxes should become null and
clear out. how to do this. At present the values from the previous record is
getting displayed.

Private Sub CboMoveTo_AfterUpdate()
Dim rs As DAO.Recordset

If Not IsNull(Me.cboMoveTo) Then
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[ITEM_NO] = """ & Me.cboMoveTo & """"
If rs.NoMatch Then
MsgBox "DWG NO DOES NOT EXIST?"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub

thanks for your help in advance
 
V

vandy

Hi ,
Thanks for your response.

currently i am trying
[forms]![Final_Receiving_Form].undo

where Final_Receiving_Form is the name of my form

and

me.[forms]![Final_Receving_Form].undo

both are not clearing out values in any control.

Am i using it in the wrong place.
thanks again
scubadiver said:
ah, ok!

So what is Vandy's answer then?

--

http://www.ready4mainstream.ny911truth.org/index.html


vandy said:
I have a combo box which searches records in the table. When i type in a
record that is not in the database it prompts a message. The problem is once
I get the message then all the values in text boxes should become null and
clear out. how to do this. At present the values from the previous record is
getting displayed.

Private Sub CboMoveTo_AfterUpdate()
Dim rs As DAO.Recordset

If Not IsNull(Me.cboMoveTo) Then
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[ITEM_NO] = """ & Me.cboMoveTo & """"
If rs.NoMatch Then
MsgBox "DWG NO DOES NOT EXIST?"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub

thanks for your help in advance
 
V

vandy

hi,

sorry to have lost the thread.

My problem is not sovled yet

I am using

[forms]![final_receiving_form].undo and i also tried

me.[forms]![final_receiving_form].undo

both did not clear values from my controls.

should i place it in any other positon apart from the after update event of
my combo box.

thanks for your time and help
 
S

scubadiver

If rs.NoMatch Then
me.undo

If you incorporate the code within the field it will only clear the field
and nothing else. I though it might have cleared every field if "me" refers
to the form as Stefan says.

Instead of putting the code into the after update event, try using a search
text box and insert the code into a command search button then it might work.

vandy said:
hi,

sorry to have lost the thread.

My problem is not sovled yet

I am using

[forms]![final_receiving_form].undo and i also tried

me.[forms]![final_receiving_form].undo

both did not clear values from my controls.

should i place it in any other positon apart from the after update event of
my combo box.

thanks for your time and help

vandy said:
I have a combo box which searches records in the table. When i type in a
record that is not in the database it prompts a message. The problem is once
I get the message then all the values in text boxes should become null and
clear out. how to do this. At present the values from the previous record is
getting displayed.

Private Sub CboMoveTo_AfterUpdate()
Dim rs As DAO.Recordset

If Not IsNull(Me.cboMoveTo) Then
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[ITEM_NO] = """ & Me.cboMoveTo & """"
If rs.NoMatch Then
MsgBox "DWG NO DOES NOT EXIST?"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub

thanks for your help in advance
 

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

Top