473,671 Members | 2,258 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Listbox values nt shown in textbox - AfterUpdate event

46 New Member
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 4080
NeoPa
32,569 Recognized Expert Moderator MVP
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 Recognized Expert Moderator MVP
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
technocraze
46 New Member
Private Sub ListBox1_AfterU pdate 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 Recognized Expert Moderator MVP
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,569 Recognized Expert Moderator MVP
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
technocraze
46 New Member
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
technocraze
46 New Member
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
3523
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 double-clicks on one of the variables in listbox A it "moves" it to listbox B. What is going on behind the scenes is that the table that holds all these variables has a yes/no field call Print. When the user double clicks on the value it fires a...
1
1153
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 = query1 - continuous forms When I open form1 I get the correct values from query1 on form1.
2
6365
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 want to do this as the selections are being made not after-the-fact after all selections are made. Thanks! Sally
0
1200
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 item is selected and an arrow key is pressed, the selection moves, but _the AfterUpdate event is fired before the ItemsSelected collection is updated_.
1
8383
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 I want to do is to allow the user to click on the row that corresponds to the correct address, and have the code behind populate the form's Address1, Address2 etc. controls with the relevant data items. I put the code for this into the...
4
4203
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), SqlConnection (sqlConnection), SqlDataAdapter (daLookupData), SqlDataAdapter (daData), DataSet (dsLookupData), and DataSet (dsData), all created via the IDE during design-time. Here is the design of my simple tables: (An example since I can't post my...
8
2428
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 PersonData Table that I have filled out and look at each MemberAlias column for each Person on the Table. It will then retrieve any persons with that MemberAlias and populate it into a ListBox, where they can then select the record from that list box...
5
6462
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 code from KeyPress in the visible field doesn't work - for some reason Access doesn't see the letters until Exit or AfterUpdate is executed - maybe Refresh too). So you have to make sure the data in the hidden field matches what's in the visible...
2
2911
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
8390
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8819
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8596
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7428
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4221
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4399
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2806
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2048
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1801
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.