update or cancelupdate without addnew or edit

G

Guest

hi
i need help
this is my code in my form_current sub
lbproperties is a listbox
the code run great, but when i try to move records or close the form etc. i
get this message: "update or cancelupdate without addnew or edit"
please advise

Private Sub Form_Current()
RefreshForm
End Sub

Sub RefreshForm()
lbProperties.RowSource = "select * from qrproductlists where productcode=" &
ProductID
lbProperties.Selected(0) = True
End Sub
 
D

Douglas J. Steele

I see nothing in that snippet that should be generating that error message.
You sure that's what's causing the error?
 
G

Guest

Do you have any code on the BeforeUpdate event of the form?
When you get the error, press Ctrl+Break to see where the code stop.
 
G

Guest

thanks ofer
it was a problem in ms access. i tried it in another pc and it worked just
fine.
thank you very much anyway
"HTH" ani kvar beemet lo yodea ma ze, chag sameach
 
G

Guest

hi again
its acting up again
this time on the other pc, access crashes entirely
on this pc i get the message. ctl-brk just tells me that its impossible to
save the record.
what i realized is that if i remove the "lbProperties.Selected(0) = True"
line, then everything goes fine
please help
thanks
 
G

Guest

I tried this code and it works fine, I tried when the RowSource return values
and when it doesn't.
I assume you tried compact and repair, I would give it another chance and
create the form again, sometimes a form is corupted and it can cause this
problem.

HTH = Hope That Help
Chag Pesach sameach gam lecha
חג פסח שמח
 

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