VB2005: Error Using a Separate Search Form

A

Anne DeBlois

I am working on a form (details) and I need my form to allow to search on
some char fields.

I have a button next to the field users can search. The button calls a
pop-up form to enter the string to search.

ItemsTableAdapter is the table adapter used for the form.

I have 1863 records in the Items table. My goal is to show only the records
matching the string using the same form.

I have modified the DataSet to add a query using a parameter:
SELECT No, Type, ..... Interest3 FROM items where nm_latin like
@srch_nm_latin order by nm_latin

This code is executed when I return from the pop-up. The string contain a
string. Example: "thing%"

If (String.IsNullOrEmpty(Me.Recherche.Text) = False) Then
Dim rech_str As String = Me.Recherche.Text
Me.ItemsTableAdapter.ClearBeforeFill = True
Me.ItemsTableAdapter.FillBy_nm_latin(Me.SignsDataSet.items,
rech_str)
End If

Once this code has executed, the BindingNavigatorchangedItem function is
called and I need to get the key values I am not displaying in the form:

' Load the key values in the form field variables
If
(Me.SignsDataSet.items.Rows(Me.ItemsBindingSource.Position).IsNull("No") =
False) Then
Me.NoKey =
Me.SignsDataSet.items.Rows(Me.ItemsBindingSource.Position).Item("No") '
ERROR
Else
Me.NoKey = 0
End If

I have seen examples where a new TableAdapter is used for search. I don't
know how I could do that since my form is all built on the
ItemsTableAdapter.

Any hint on how to do this will be appreciated.
 
K

Kevin Yu [MSFT]

Hi Anne,

I noticed in your code, you're using Me.SignsDataSet.items.Rows. Is items
table in the DataSet? If so, could you let me know the error message? Is it
a build error or runtime error?

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

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