473,435 Members | 1,493 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,435 software developers and data experts.

Combobox Not In List Event

This has probably been posted before but i've searched and couldn't
find the answer I'm looking for (or just couldn't understand it) but
here's what i'm trying to do:

i have a table (tbl_participants). One field on this table is
R_Category which looks up the table tbl_Category (field "Category").

I have created a form (frm_Participants) based on tbl_Participants.
This form has a combobox on it for the R_Category field. I have placed
the following code on the On Not In List Event for R_Category:

*****Code Start*****
Private Sub R_Category_NotInList(NewData As String, Response As
Integer)

Dim rstCat As ADODB.Recordset
Dim strAnswer As String

strAnswer = MsgBox("'" & NewData & "' is not in list of Categories"
& vbNewLine & vbNewLine & "Do you want to add it?", _
vbQuestion + vbYesNo, "Category Not in List!")

If strAnswer = vbYes Then
Set rstCat = New ADODB.Recordset
rstCat.Open "tbl_Category", CurrentProject.Connection,
adOpenStatic, adLockOptimistic

rstCat.AddNew
rstCat!Category = NewData
rstCat.Update
MsgBox "'" & NewData & "' added to list of Categories",
vbOKOnly + vbInformation, "Category Added!"
Else
MsgBox "'" & NewData & "' has not been added to list of
Categories!", vbInformation + vbOKOnly, "Process Cancelled!"
IsNull (Me.R_Category)
End If

rstCat.Close
Set rstCat = Nothing
Response = acDataErrAdded

End Sub
******Code End*******

When i try to add a new category to the list, after my custom message
boxes appear, it still comes up with the access message "The text you
entered isn't an item on the list....." and my new item doesn't show up
on the list. However, when i go to tbl_Category it is there!!! Can
anyone help???? Is there an error with my code???

Thanks in advance
Bec

Dec 14 '05 #1
0 1247

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Nicolae Fieraru | last post by:
Hi All, I am trying to change the rowsource of a combobox when I click on it. I played with many events, associated with the form and the combobox, but still haven't figured out what is the way...
0
by: Susan Bricker | last post by:
The following error: "The current field must match the join key '?' in the table that seves as t the 'one' side of one-to-many relationship. Enter a record in the 'one' side table with the...
7
by: NCrum | last post by:
I want to set the Default value of a Combobox for any changeable record and have got this working but it is totaly unsatisfactory see the code below I loop through the items in the Combo looking...
7
by: charliewest | last post by:
Using .Net CF, i have created a 2 dimension ArrayList, and "binded" this list to a ComboBox control using the "DataSource" property. I have set the DisplaySource and ValueMember properties as well....
5
by: ross kerr | last post by:
Hi All, I am extending the combobox to create a control that selects an item based on the text the user is typing into the text area of the control. I have an issue that occurs only when i...
0
by: | last post by:
Hi All. I have a problem with combobox, what I want is when combobox gets focus I need it to show the dropdown list t.This is fine if the user selects the combobox via keystrokes but when the...
12
by: eetarnold | last post by:
Hi Gurus, As I've read in other posts the past couple of days, I've read many great posts and haven't figured out how I can solve this problem...I'm trying to make a form very user friendly for...
6
by: tbrown | last post by:
I have a combobox with items like this: {one,two,three}. The selected index is 0, so "one" appears in the combobox text. When the user drops down the list, and selects "two", for example, I...
4
by: =?Utf-8?B?UmljaA==?= | last post by:
Greetings, I have to load 30,000 unique names into a combox. Filling a dataTable takes only a few milliseconds. But populating the combobox and displaying the list takes several seconds - way...
1
by: Man4ish | last post by:
Hi, How Eventlistner can be used with rendred combo box. I got one example of combobox in table as follows . /* * Copyright (c) 1995 - 2008 Sun Microsystems, Inc. All rights reserved. * ...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
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...
1
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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...

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.