Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

changing values in datagrid

Status
Not open for further replies.

goilaswati

Programmer
Mar 3, 2003
20
0
0
IN
sir

i have a form in which i have a text box & a datagrid. the datagrid contains feilds such as code,name etc. the text box is made for entering code numbers. my purpose is that whenever i enter any code number in the text box, the datagrid should display codes only like those entered in the text box. i have done it this way:

SQL = "select * from M_EMPLOYEE where NAME like '" & Me.txt_empcode.Text & "*' "

Me.Adodc1.recordsource = sql
Me.Adodc1.Refresh
Me.DataGrid1.Refresh
Me.Adodc1.Recordset.Requery

but this is not working , please help
 
How about first going back to the other threads which you have started and received answers for and giving a response to those answers, as well as if they helped, or what actually worked for you, and if the suggestion answers did help, marking them as helpful posts (see at the bottom of the post the option "Mark this post as a helpful/expert post!") and also let the ones who have helped know that there help is appreciated - a Thank you.

No, it doesn't look like you are doing this correctly.
When you change a text field, then change the recordset field also, or better, when the user clicks update, then change the recordset:

Text1.Text = "123"

Adodc1.Recordset.Fields("FieldName1"),Value = Text1.Text

Once all fields are ready to be updated, use:
Adodc1.Recordset.Update

The grid should then also be automatically updated.

 
sir

thanks for your help. i tried it but as far as i can understand it, it will change the already existing value of the particular field in the table. this i do not want.
i want to show the values which already exist in the table.
these values should be somewhat like the value entered in the text box.
if i am wrong please correct me & explain your procedure.

swati

 

Either requery the recordset with Adodc1.Recordset.Requery (first changing sql criteria and setting the Me.Adodc1.recordsource = sql again), or use a client side cursor and then the Filter method of ADO:

Adodc1.Recordset.Filter "Name= '" & Me.txt_empcode.Text & "'"
 
sir

thanks a lot. but this is not helping in any way. let me tell u that i have done the same thing earlier also. then i had back- end as access & i used dao. now i have back-end as oracle & i am using ado. does this make any difference. if yes then what. if no then is there any other way to do this.


swati
 
Hi,
I don what problem actually u r facing. it might be wildcard character problem. replace * with %. if it doesn't work plz let us know what problem u r having
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top