hi!!!


am palcy , am having problem in my listview with my save button whenever i try to edit something then press the command button for saving the update that ive' done it give's me the error "querry is too complex" then pointing my "rs.Update" code
any solutions or proper coding for updating a recordset ... thank you in adcanve... here is my coding below


code:

connection
rs.Open "select * from permanent where num='" & num.Caption & "'", con, 3, 3
If rs.RecordCount <> 0 Then
rs.Update
rs("num") = (num.Caption)
rs("name") = UCase(txtname.Text)
rs("sex") = (sex.Text)
rs("year") = (year1.Text)
rs("ncee") = (ncee.Text)
rs("month") = (month.Text)
rs("day") = (day.Text)
rs("year1") = (year2.Text)
rs("place") = (place.Text)
rs("city") = (city.Text)
rs("provincial") = (prov.Text)
rs("parent") = (parent.Text)
rs("address") = (address.Text)
rs("primary") = (prim.Text)
rs("year2") = (year3.Text)
rs("intermediate") = (inte.Text)
rs("year3") = (year4.Text)
rs("high_school") = (high.Text)
rs("year4") = (year5.Text)
rs("year5") = (co1.Text)
rs("elp1") = (elp1.Text)
rs("no1") = (no1.Text)
rs("final1") = (fin1.Text)
rs("final2") = (fin2.Text)
rs("final3") = (fin3.Text)
rs("final4") = (fin4.Text)
rs("final5") = (fin5.Text)
rs("final6") = (fin6.Text)
rs("final7") = (fin7.Text)
rs("final8") = (fin8.Text)
rs("re-xam1") = (re1.Text)
rs("re-xam2") = (re2.Text)
rs("re-xam3") = (re3.Text)
rs("re-xam4") = (re4.Text)
rs("re-xam5") = (re5.Text)
rs("re-xam6") = (re6.Text)
rs("re-xam7") = (re7.Text)
rs("re-xam8") = (re8.Text)
rs("units1") = (unit1.Text)
rs("units2") = (unit2.Text)
rs("units3") = (unit3.Text)
rs("units4") = (unit4.Text)
rs("units5") = (unit5.Text)
rs("units6") = (unit6.Text)
rs("units7") = (unit7.Text)
rs("units8") = (unit8.Text)
rs("remark1") = (rem1.Text)
rs("remark2") = (rem2.Text)
rs("remark3") = (rem3.Text)
rs("remark4") = (rem4.Text)
rs("remark5") = (rem5.Text)
rs("remark6") = (rem6.Text)
rs("remark7") = (rem7.Text)
rs("remark8") = (rem8.Text)
rs("year6") = (co3.Text)
rs("elp2") = (elp2.Text)
rs("no2") = (no2.Text)
rs("final9") = (fin9.Text)
rs("final10") = (fin10.Text)
rs("final11") = (fin11.Text)
rs("final12") = (fin12.Text)
rs("final13") = (fin13.Text)
rs("final14") = (fin14.Text)
rs("final15") = (fin15.Text)
rs("re-xam9") = (re9.Text)
rs("re-xam10") = (re10.Text)
rs("re-xam11") = (re11.Text)
rs("re-xam12") = (re12.Text)
rs("re-xam13") = (re13.Text)
rs("re-xam14") = (re14.Text)
rs("re-xam15") = (re15.Text)
rs("unit9") = (unit9.Text)
rs("unit10") = (unit10.Text)
rs("unit11") = (unit11.Text)
rs("unit12") = (unit12.Text)
rs("unit13") = (unit13.Text)
rs("unit14") = (unit14.Text)
rs("unit15") = (unit15.Text)
rs("remark9") = (rem9.Text)
rs("remark10") = (rem10.Text)
rs("remark11") = (rem11.Text)
rs("remark12") = (rem12.Text)
rs("remark13") = (rem13.Text)
rs("remark14") = (rem14.Text)
rs("remark15") = (rem15.Text)
rs("year7") = (summer1.co5.Text)
rs("elp3") = (summer1.elp3.Text)
rs("no3") = (summer1.no3.Text)
rs("final16") = (summer1.fin16.Text)
rs("final17") = (summer1.fin17.Text)
rs("final18") = (summer1.fin18.Text)
rs("final19") = (summer1.fin19.Text)
rs("final20") = (summer1.fin20.Text)
rs("re-xam16") = (summer1.re16.Text)
rs("re-xam17") = (summer1.re17.Text)
rs("re-xam18") = (summer1.re18.Text)
rs("re-xam19") = (summer1.re19.Text)
rs("re-xam20") = (summer1.re20.Text)
rs("unit16") = (summer1.unit16.Text)
rs("unit17") = (summer1.unit17.Text)
rs("unit18") = (summer1.unit18.Text)
rs("unit19") = (summer1.unit19.Text)
rs("unit20") = (summer1.unit20.Text)
rs("remark16") = (summer1.rem16.Text)
rs("remark17") = (summer1.rem17.Text)
rs("remark18") = (summer1.rem18.Text)
rs("remark19") = (summer1.rem19.Text)
rs("remark20") = (summer1.rem20.Text)
rs.Update
End If
rs.Close: Set rs = Nothing
con.Close: Set con = Nothing

I analysed your code. The code is for Updating the existing record so no need to update the field num. Rs.Update should end of all the fields. If you removed the starting Rs.Update then u can update. Just have a try and let me the status of it.


Shailaja :)

thank you :)

i tried your suggestion but still giving the same error any suggestion like different code for updating or editing a recordset??

ellow!! :)

i tried your suggestion but still its giving the same error any more suggestions like another way of updating or editing code for a recordset? thankz in advance :)

Can you provide me the structure of the table that u have been used.

Shailaja :)

That first Rs.Update may need to be Rs.Edit or just removed like manoshailu already said. Also, it should be Rs.Fields("FieldName").Value = newvalue for readability and maintainability.

Good Luck

Hi,

I guess, field names with special chars, like "re-xam16", need to be enclosed in square bracket..

Change this way:
rs("[re-xam16]") = (summer1.re16.Text)

Regards
Veena

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.