473,721 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unable to update combo box using list box selection - error 2115

6 New Member
I am trying to set the value of a combo box based on the selection of a list box. I have created a very simple generic form to try to achieve this goal, but without success. The form has a list box bound to a query, a button, and a combo box bound to another query. The queries for the list box and the combo box are independent. I can set the value of the combo box when the form loads (sub Form_Load) and when I click on the button (sub Command2_Click) , but when I make a selection in the list box (sub List5_AfterUpda te) I get Runtime error 2115: The Macro of function set to the BeforeUpdate or ValidationRule property for this field is preventing MS Access from saving the date in the field. I do not have any validation rules set and this is a complete listing of my code.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command2_Click()
  2.     Me.Combo0.SetFocus
  3.     Me.Combo0.ListIndex = 2
  4. End Sub
  5.  
  6. Private Sub Form_Load()
  7.     Me.Combo0.SetFocus
  8.     Me.Combo0.ListIndex = 0
  9. End Sub
  10.  
  11. Private Sub List5_AfterUpdate()
  12.     Me.Combo0.SetFocus
  13.     Me.Combo0.ListIndex = 3
  14. End Sub
  15.  
Nov 3 '11
11 4635
mcompagno
6 New Member
Success at last!
I had the answer all along in another part of my code.
Instead of using listindex I used itemdata:
Me.combo0= Me.combo0.ItemD ata(1)
This does the same thing as the setting the listindex from the point of view of the user, but does not throw the error.
Nov 9 '11 #11
sierra7
446 Recognized Expert Contributor
Glad you got it to work
S7
Nov 9 '11 #12

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

Similar topics

1
1165
by: Katie | last post by:
I am a rather inexperienced VBA programmer so this may be a very simple question! I need to update combo boxes using VBA to incorporate filters from other fields. I have been trying to use .RowSource, but I can't get it to work. Any advice? Could you email at above address! Katie
3
11099
by: Brian | last post by:
I have a form that has a textbox used to search records in a table. On the form I have a listbox which shows each record in the table. When you click on each row in the listbox the rest of the form updates to show the other fields in the table. The problem I am having is when I enter text to search the table the list narrows successfully, but the rest of the information still reflects the first record in the table. When I click on one of...
2
7170
by: sianan | last post by:
I am having a problem doing the following in generics. I have two list of a custom item type. I need to iterate through the first list and match each item against another list to see if there is a match. If a match is found, I need to move the matched item into another list. I want to compare the objects by value. The items in each list have an ID property (of type object) which I want to convert to a strng in order to be able to do...
3
3847
by: Cagey | last post by:
What I'm trying for: If this selection or if click on selection (highlighted line choice/ which ever selection change) w/in query's combo dropdown list box (on Switchboard), then Open in Datasheet View, the specific underlying record's Row... showing all columns Or selected columns. For a specific row's record ONLY, Or for all Xs (same type), or for the whole data sheet (all records... includes all types then), but focus still opens...
3
23247
by: keithsimpson3973 | last post by:
I have 6 combo boxes on a vb form. Is there a way, using vb6, to remove the list item that was selected in the first combo box from the list of the second, third fourth, fifth, and sixth combo box list? This is what I have tried with no luck cb = combobox1.listindex combobox2.list = combobox1.list combobox2.removeitem cb
2
2379
by: JweldonH | last post by:
My issue probably has a simple answer. I want to limit a populated combo box to items that are NOT in use in another table. I have a Table with a field that looks up values from another table via a combo box. As I select items from that combo box list, I would like for the list to automatically remove that selection from the combo box list so it wont be availble to select. (And have it add any item that I change or remove from the tabe) The...
1
1256
by: napstar | last post by:
I have 2 combo boxes which can be used to set an employee's availability and Salary type on an employees form in access. I have sub which changes availability to “Full time”, if the salary type is “Retainer” ;but when I do this I keep getting Error 2115 : The macro or function set to the BeforeUpdate or ValidationRule property for this field is preventing Microsoft Access from saving the data in the field Private Sub SalaryType_Click() ...
4
2588
by: lulu123 | last post by:
here's my problem 1) rowsource .RowSource = "select distinct , " & "from Projects " & " where =" & Me! I have the above code, and it works fine. however, i want to make the combo box in alphabetical order by . I tried to add "order by " after "me!". But it gives me error msg. Can someone tell me how can i do that. Thanks. 2) REfresh the combo box list after add a record.
8
3357
by: hollinshead | last post by:
Hi there i have bit of an issue. i haver this database that is purely used for searching records under certain criteria. This criteria is chosen by the user on a form using list boxes and combo boxes. So when the criteria is chosen the user selects a click command button and then the results are displayed on another form. I have successfully created the code for the combo boxes on the form.The list boxes are are the problem which are set to...
16
19144
by: rudivs | last post by:
I would like to do data validation in the BeforeUpdate procedure, but Access gives me a runtime error when I try to do this: An example of what I am trying to do is as follows: Private Sub Option_BeforeUpdate(Cancel As Integer) If Option = A Then Answer=MsgBox("Don't you mean B?",vbYesNo) If Answer = vbYes Then
0
9367
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9215
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...
0
8007
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...
1
6669
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5981
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4484
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
4753
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3189
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
3
2130
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.