473,387 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Listbox values nt shown in textbox - AfterUpdate event

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
7 4058
NeoPa
32,556 Expert Mod 16PB
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
14,534 Expert Mod 8TB
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
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
14,534 Expert Mod 8TB
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
32,556 Expert Mod 16PB
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
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
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

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

Similar topics

5
by: Bill | last post by:
I have have two list boxes. One is a listing of all possible variables. We'll call this listbox A. The other is a listing of all the selected variables. We'll call this listbox B. If a person...
1
by: thomas goodwin | last post by:
Hi, This is a bit long explanation to what is probably a very easy problem: I have query 1: "Select col1 from table 1" I have form1 with: - a textbox for col1 - recordsource for form1 =...
2
by: Sally | last post by:
I have a simple multiselect listbox with a rowsorce of MemberID, MemberName, SendLetter. SendLetter is a Yes/No field. What is the code to set SendLetter to Yes when the user selects MemberName? I...
0
by: jbm05 | last post by:
Hi, I'm using Access 2003 (11.6355.6360) SP1, and I'm seeing the following behavior if I create a listbox, populate it with some arbitrary values, and set multiselect to "extended": 1. If an...
1
by: Edward | last post by:
I am having a terrible time getting anything useful out of a listbox on my web form. I am populating it with the results from Postcode lookup software, and it is showing the results fine. What...
4
by: dtblankenship | last post by:
Hello everyone, I know this question has been asked many times in the forums, and after spending a few days reading, I am still confused as to the answer. I have a ListBox (lstBox),...
8
by: daddydfsu via AccessMonster.com | last post by:
I am trying to create a ListBox based on a search from a TextBox. I have a TextBox where I will enter in a MemberAlias. I want to click on a Search Button and that will do a select from a...
5
by: DFS | last post by:
This works pretty well, and it's easy, but it's not the ultimate solution. The kludgey part is it uses a hidden field to incrementally capture the keystrokes in the visible field (because executing...
2
by: teo | last post by:
I have a Listbox, if I set EnableViewStarte = False the AutopostaBack fired by SelectedIndexChanged doesn't work. The 'SelectedIndexChanged' event should call
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.