By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,456 Members | 1,390 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,456 IT Pros & Developers. It's quick & easy.

Listbox values nt shown in textbox - AfterUpdate event

P: 46
Hi guys,

I encountered this error while using the AfterUpdate event for my listbox.
Error: Update or CancelUpdate without using AddNew or Edit. What i wanted to achieve is just to display the selected values from the listbox into the textboxes. I have bounded both my listbox and textbox to the controlSource of the field of my table. I have two combo boxes. One is getting the from the query and other is matching the corresponding values based on the first combo box and listbox values is based on the second combo boxes, which meant that teh sec cbox and listbox are populated. May i knw what can be done for the Afterupdate event to resolve this error. tks
Jan 14 '07 #1
Share this Question
Share on Google+
7 Replies


NeoPa
Expert Mod 15k+
P: 31,186
Please look in this thread and consider adding those items necessary to give an answer.
(POSTING GUIDELINES: Please read carefully before posting to a forum)
I tried to read it and it was like swimming through treacle.

MODERATOR
Jan 14 '07 #2

MMcCarthy
Expert Mod 10K+
P: 14,534
Hi guys,

I encountered this error while using the AfterUpdate event for my listbox.
Error: Update or CancelUpdate without using AddNew or Edit. What i wanted to achieve is just to display the selected values from the listbox into the textboxes. I have bounded both my listbox and textbox to the controlSource of the field of my table. I have two combo boxes. One is getting the from the query and other is matching the corresponding values based on the first combo box and listbox values is based on the second combo boxes, which meant that teh sec cbox and listbox are populated. May i knw what can be done for the Afterupdate event to resolve this error. tks
Post the actual code that you are using in the After Update event.
Jan 15 '07 #3

P: 46
Private Sub ListBox1_AfterUpdate event()

Dim rs as Object

Set rs = RecordSet.Clone
rs.FindFirst "[Serialno] = " & Str(Nz(Me![ListBox1]))
if not rs.EOF then Me.Bookmark = rs.Bookmark
Me.Text1.Value = ListBox1.Column(0) (suspect this line is the main error)

Elaboration
Serial no = pk
Listbox1 = populated list
I am using MS Acess and visual basic, what i want to achieve is to display the selected value from the listbox and put in the textbox. But dnt get it why i always get this annoying error! Very much appreciated if u guys can assist me in pointing or highlighting out the error. Tks for any kind advice and assistance in advance.

Error: CancelUpdate or Update without AddNew or Edit.
Tks.
Jan 15 '07 #4

MMcCarthy
Expert Mod 10K+
P: 14,534
Try this ...

Expand|Select|Wrap|Line Numbers
  1. Private Sub ListBox1_AfterUpdate()
  2. Dim rs as Object
  3.  
  4.    Set rs = RecordsetClone
  5.    rs.FindFirst "[Serialno] = " & Str(Nz(Me![ListBox1]))
  6.    if not rs.EOF then Me.Bookmark = rs.Bookmark
  7.    Me.Text1 = "'" & Me.ListBox1 & "'"
  8.    rs.Close
  9.  
  10. End Sub
  11.  
Mary
Jan 15 '07 #5

NeoPa
Expert Mod 15k+
P: 31,186
I suspect that your fundamental problem lies in binding more than one control to the same field. That would cause this sort of clash.
Think about making one of the controls unbound.
Jan 15 '07 #6

P: 46
tks MAN! I will try this out and let u knw the outcome.

I suspect that your fundamental problem lies in binding more than one control to the same field. That would cause this sort of clash.
Think about making one of the controls unbound.
Jan 15 '07 #7

P: 46
tks mary
i will try that out!

Try this ...

Expand|Select|Wrap|Line Numbers
  1. Private Sub ListBox1_AfterUpdate()
  2. Dim rs as Object
  3.  
  4.    Set rs = RecordsetClone
  5.    rs.FindFirst "[Serialno] = " & Str(Nz(Me![ListBox1]))
  6.    if not rs.EOF then Me.Bookmark = rs.Bookmark
  7.    Me.Text1 = "'" & Me.ListBox1 & "'"
  8.    rs.Close
  9.  
  10. End Sub
  11.  
Mary
Jan 15 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.