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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fill up frm.field value with rs.value - desperate for help 1

Status
Not open for further replies.

TTThio

Programmer
May 3, 2001
185
US
Hi guys,

I've become really desperate here. Need a big help. :-s

My situation is:

In the main form, there's subform (number of records depend on the cbobox selection).

On the cbobox_afterUpdate()

subform.requery

set rs = subform.recordsetclone
rs.movefirst

do until rs.eof
with subform
.bookmark = rs.bookmark ' to make each value applicable for each record
.text1 = rs("text1")
.text2 = rs("text2")
end with

rs.movenext
Loop

rs.close
end sub

When I do cbobox update, it gives me error message
"Update or CancelUpdate withou Edit/AddNew"
All doesn't work.

Yet, when I try to debug it, and run the code step by step, no error message, the data in the subform is displayed as per code.

What's missing here?

Any useful idea or help is greatly appreciated.

Tin Tin



 
Try something like this.

On the cbobox_afterUpdate()

subform.requery

set rs = subform.recordsetclone
rs.movefirst

do until rs.eof
with subform
.bookmark = rs.bookmark ' to make each value applicable for each record
.Edit ' Or .AddNew to Add
.text1 = rs("text1")
.text2 = rs("text2")
.Update
end with

rs.movenext
Loop

rs.close
end sub
-------------------------
Regards
JoaoTL
-------------------------

 
Hi JoaoTL,

thank you...thank you.....

It works, I really appreciate it!!

regards,
Tin Tin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top