Hey there :)

[IMG]http://img.photobucket.com/albums/v374/taylormsj/rascalshelp.jpg[/IMG]

I am currently creating a program for my mums business.

I have a .mdb access data base with member details.

In the screen above, i want to type the ID number into the text box, click search and their data to be filled into the text boxes.

I have got somewhere, but i cant seem to get it to fill the information i want. When i click, the first record is filled. If i put a different ID number, the first record still fills.

This is my code

Private Sub btnsearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsearch.Click
        Dim index As String
        index = txtid.Text
        BindingContext(ChildID1, "members").Position = index

        OleDbDataAdapter1.Fill(ChildID1)
        lblfirst1.DataBindings.Add("TEXT", ChildID1, "members.First name")
        lbllast1.DataBindings.Add("TEXT", ChildID1, "members.Last name")
        lbldate1.DataBindings.Add("TEXT", ChildID1, "members.DOB")
        lblpost1.DataBindings.Add("TEXT", ChildID1, "members.Post Code")
        lbltelephone1.DataBindings.Add("TEXT", ChildID1, "members.Phone")
        lblid1.DataBindings.Add("TEXT", ChildID1, "members.ID")

        btnadmit.Enabled = True
        btnadmit2.Enabled = True
        btnsearch.Enabled = False

    End Sub

Any ideas how i can get it to work, sorry if this doesn't make sense :D

Taylormsj

maybe you have missed something in the SQL statement something like "SELECT name,addresss FROM yourtable WHERE memberID = '" & txtSearch.Text & "'"

WHERE clause is important in searching something in the database...

maybe you have missed something in the SQL statement something like "SELECT name,addresss FROM yourtable WHERE memberID = '" & txtSearch.Text & "'"

WHERE clause is important in searching something in the database...

Thank you for your reply. I am not using SQL statements for this program, i am using the oledbdataadapter and data sets using the wizards that pop up from the toolbox. If i add the WHERE statement to my query, that might work, i shall try thank you

the output directory of your .mdf file might be the problem. because VB 2008 copies the .mdf and .ldf file to the bin folder of your project. to solve that change the output property to DoNotCopy.
then try running your programme.

Im using Visual studio 2005, does this do that aswell? where is the output property ?? thankyou

I think i may have come up with a solution.

I played around with everyones suggestions but couldnt get anything to work, i went back to my original code and using this gives me what i want:

BindingContext(DataSet11, "members").Position = (txtid.Text - 1)

OleDbDataAdapter1.Fill(DataSet11)

thanks for all of your help :)

This article has been dead for over six months. Start a new discussion instead.