473,473 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

MS Access NotInlist add to combo box

65 New Member
i just posted another piece of code before i came accross this one. it almost adds the new value to the table, except now i get an error back saying the value isnt in the list AFTER i told it to add it to the list. the new code is below. any help is GREATLY appreciated!


Private Sub PRININVEST_NotInList(NewData As String, Response As Integer)

Dim db As Database
Set db = CurrentDb

'Ask the user if they want to add to the list
If MsgBox("Do you want to add this value to the list?", vbYesNo + vbQuestion, "Add new value") = vbYes Then

'The user clicked Yes - add the new value
db.Execute "INSERT INTO proposal (PRININVEST) VALUES (""" & NewData & """)", dbFailOnError

'Tell Access you've added the new value
Response = acDataErrAdded

Else

'The user clicked No - discard the new value
Me.PRININVEST.Undo
'Tell Access you've discarded the new value
Response = acDataErrContinue

End If

db.Close
Set db = Nothing

End Sub
Jun 14 '06 #1
1 4522
PEB
1,418 Recognized Expert Top Contributor
First you have to turn the Response parameter to False
Response=False

When U add the new value you have to refresh or requery the combo box for appearing the new value

Then you can turn the response=true

And the new value will be accepted :)
Sep 3 '06 #2

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

Similar topics

3
by: Pieter Linden | last post by:
Just got done reading some of ADH2000 about comboboxes and the NotInList event... Doesn't look like it's possible to tweak the behavior of this so that I can have a non-text bound column, can I?...
4
by: William Bradley | last post by:
I have tried to create a combo box that will allow me to enter a company name at the keyboard and have it saved alphebetically into the combo box's list. Using the wizard, I have tried the...
5
by: Almir | last post by:
This db i created has been driving me nuts. I have this one table LOCATIONS, and in the data entry forms, the user is suppose to change the locations of the equipment or set a location when first...
1
by: Steve Leferve | last post by:
Can someone tell what what objects I have to work with on the 'NotInList' event? Basically I want to have a pop-up prompt the user if they want to add the data they typed into the database. ...
8
by: Heather | last post by:
I want to make a message box appear on the NotInList event for several combo boxes. The message box will alert the user that if they need to add a value they must go through the database...
3
by: mal | last post by:
Sorry for repost - system added to another subject for some reason Have tried numerous ideas from the group to solve this one. It is such a simple example that it should be straightforward ! I...
2
by: whilstiwait | last post by:
I have a form containing a number of unbound combo boxes in three columns. Each column has boxes named "aaaa0", "aaaa1", etc. Using syntax like: With Forms(Me.Form.Name).Controls("txtTechnology"...
4
by: CAD Fiend | last post by:
Hello, I have a combo box (cmbFirstName) on a form that is hitting a query (qryFirstName) and then putting that selected (or typed by user) value to the table field (name FirstName) on the table...
2
FireMedic
by: FireMedic | last post by:
Hello all, I am creating an application that has an equipment inventory and maintenance form that has numerous subforms that are displayed depending on the category of equipment selected. I have...
4
by: EManning | last post by:
I have a combobox whose rowsource is a union query. This query displays a person's name in "lastname, firstname" format and in "firstname lastname" format. The query results look like this: ...
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
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
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
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,...
1
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.