473,668 Members | 2,360 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

'Problem with NotInList and unbound Form

Hi all,

I have a Problem with combobox-property "NotInList" and an unbound Form.

The situation:

On my main form i have three comboboxes for data-exchange (here: Names of
distributor, reseller and final customers[1], the whole database is made
for storing information about quotatations[2] - no, not for quoting itself)
ut the boxes actually may not contain all our distributors and reseller's
names (and final customers are not stored anywhere up to now) and
therefore, I want to give the users (me and a colleague ;) the possibility
to enter a customers name if during input it ist detected, that it isn't
stored.

For this purpose i use the "NotInList" property and i use it up to now with
a bound form - works good.
But now i wish to change to unbound form because i wish to pretend some
input-errors like leading/following spaces (for instance thew customer's
name is 'Multimedia Inc' but the user by mistake types
in '<space>Mutimed ia Inc'n - the next time another user types
in 'Multimedia Inc' it won't be found yet because of the leading space).

My problem:
I cannot get my code working.

This is my code for the combobox (here: final customer):
-------------

Private Sub cboFinalCustome r_NotInList(New Data As String, Response As
Integer)
*On Error GoTo fehler

* * Dim erg As Integer

* * Response = acDataErrAdded

* * 'MessageBox einblenden
* * erg = MsgBox("Der Eintrag '" & NewData & "' ist nicht in der Liste."
_
* * & "Möchten Sie den Eintrag erfassen?", vbYesNo + vbExclamation)

* * 'Wenn OK gedrückt, Erfassungsdialo g zeigen
* * If erg = vbYes Then
* * * * DoCmd.SetWarnin gs False
* * * * Response = acDataErrContin ue
* * * * DoCmd.OpenForm "frmFinalCustom erErfassung", DataMode:=acFor mAdd,
windowmode:=acD ialog, OpenArgs:=NewDa ta

* * * * 'Warnungen wieder einschalten
* * * * DoCmd.SetWarnin gs True

* * Else
* * *Response = acDataErrContin ue
* * *Me!cboFinalCus tomer.Undo
* * End If

ende:
* * Exit Sub

fehler:
* * Me!cboFinalCust omer.Value = Me!cboFinalCust omer.ItemData(0 )
* * Resume ende
End Sub
---------------------

And the following is my code for the unbound input form
----

Private Sub cmdCancel_Click ()
* * Dim erg As Long
* * 'Message-Box erzeugen und Anzeigen
* * erg = MsgBox("Eingabe Abbrechen?", Buttons:=vbYesN o + vbExclamation,
Title:="Final Customer Eingabe")

* * * * 'wenn Abbruch bestätigt
* * If erg = vbYes Then
* * * * 'dann Formular schliessen
* * * * DoCmd.Close
* * Else
* * * * 'Zurück zum letzten Steuerelement
* * * * Screen.Previous Control.SetFocu s
* * End If

End Sub
Private Sub cmdSave_Click()
* * 'Eigene speichern-Routine wg. Nachbehandlung der Eingaben
* * Dim db As DAO.Database
* * Dim rsFinalCustomer As DAO.Recordset

* * On Error GoTo err_cmdStore

* * Set db = CurrentDb()

* * 'Tabelle Final Customer öffnen
* * Set rsFinalCustomer = db.OpenRecordse t("tblFinalCust omer")

* * 'Speichern mit Nachbehandlung
* * With rsFinalCustomer
* * * * 'neuen Datensatz anfügen
* * * * .AddNew

* * * * 'Textfeldinhalt umkopieren
* * * * !strFinalName = Trim(txtFinalNa me.Value)

* * * * 'Datensatz schreiben
* * * * .Update

* * * * 'Recordset schliessen
* * * * .Close
* * End With

end_cmdSave
* * 'Datenbankobjek te zerstören
* * db.Close
* * Set rsFinalCustomer = Nothing
* * Set db = Nothing

* * Exit Sub

err_cmdSave
MsgBox Err.Description
Resume end_cmdSpeicher n
End Sub
Private Sub Form_Close()
* *
* * Forms!frmMaster Test!cboFinalCu stomer.Requery *
End Sub
Private Sub Form_Load()
*Me!txtFinalNam e.SetFocus
*Me!txtFinalNam e.Value = Me.OpenArgs

End Sub
--------

* here i get an Error "Item must be saved before requery"

I couldn't figure out where's my mistake/error in reasoning whole day.

Can anybody help me coming on the right way?

Volker

[1]Only names are stored not whole adresses. Just names and SAP number
[2]Our systems are limited in several functions so i try to get over
those limitations by using access - quotations themselves are
made with a web-tool based on SAP netweaver
--
Im übrigen bin ich der meinung, dass TCPA/TCG verhindert werden muss
Aug 1 '08 #1
6 2676
Perhaps there's a compelling reason, but I don't see why you do not validate
and edit the information in the Before Update and After Update properties of
the Controls and of the Form itself, and use a Bound Form. There are rare
times when it is needful to use an unbound form for handling data, but those
times are _rare indeed_. In any case, "unbound" or not, I would presume
that you are using a Table or Query as the Row Source on the Combo Box, so a
"standard solution" for that should work just fine.

That is, pop up a form to enter the missing Row Source information, save it,
and return. There are quite a number of examples... many can be found by
using http://groups.google.com to search the archives here; others can be
found in resources linked from my SharePoint page at
http://sp.ntpcug.org/accesssig/default.aspx (see the Resources list on that
same page).

Larry Linson
Microsof Office Access MVP
"Volker Neurath" <ne*******@gmx. dewrote in message
news:tm******** ****@ID-29596.user.indi vidual.de...
Hi all,

I have a Problem with combobox-property "NotInList" and an unbound Form.

The situation:

On my main form i have three comboboxes for data-exchange (here: Names of
distributor, reseller and final customers[1], the whole database is made
for storing information about quotatations[2] - no, not for quoting
itself)
ut the boxes actually may not contain all our distributors and reseller's
names (and final customers are not stored anywhere up to now) and
therefore, I want to give the users (me and a colleague ;) the possibility
to enter a customers name if during input it ist detected, that it isn't
stored.

For this purpose i use the "NotInList" property and i use it up to now
with
a bound form - works good.
But now i wish to change to unbound form because i wish to pretend some
input-errors like leading/following spaces (for instance thew customer's
name is 'Multimedia Inc' but the user by mistake types
in '<space>Mutimed ia Inc'n - the next time another user types
in 'Multimedia Inc' it won't be found yet because of the leading space).

My problem:
I cannot get my code working.

This is my code for the combobox (here: final customer):
-------------

Private Sub cboFinalCustome r_NotInList(New Data As String, Response As
Integer)
On Error GoTo fehler

Dim erg As Integer

Response = acDataErrAdded

'MessageBox einblenden
erg = MsgBox("Der Eintrag '" & NewData & "' ist nicht in der Liste."
_
& "Möchten Sie den Eintrag erfassen?", vbYesNo + vbExclamation)

'Wenn OK gedrückt, Erfassungsdialo g zeigen
If erg = vbYes Then
DoCmd.SetWarnin gs False
Response = acDataErrContin ue
DoCmd.OpenForm "frmFinalCustom erErfassung", DataMode:=acFor mAdd,
windowmode:=acD ialog, OpenArgs:=NewDa ta

'Warnungen wieder einschalten
DoCmd.SetWarnin gs True

Else
Response = acDataErrContin ue
Me!cboFinalCust omer.Undo
End If

ende:
Exit Sub

fehler:
Me!cboFinalCust omer.Value = Me!cboFinalCust omer.ItemData(0 )
Resume ende
End Sub
---------------------

And the following is my code for the unbound input form
----

Private Sub cmdCancel_Click ()
Dim erg As Long
'Message-Box erzeugen und Anzeigen
erg = MsgBox("Eingabe Abbrechen?", Buttons:=vbYesN o + vbExclamation,
Title:="Final Customer Eingabe")

'wenn Abbruch bestätigt
If erg = vbYes Then
'dann Formular schliessen
DoCmd.Close
Else
'Zurück zum letzten Steuerelement
Screen.Previous Control.SetFocu s
End If

End Sub
Private Sub cmdSave_Click()
'Eigene speichern-Routine wg. Nachbehandlung der Eingaben
Dim db As DAO.Database
Dim rsFinalCustomer As DAO.Recordset

On Error GoTo err_cmdStore

Set db = CurrentDb()

'Tabelle Final Customer öffnen
Set rsFinalCustomer = db.OpenRecordse t("tblFinalCust omer")

'Speichern mit Nachbehandlung
With rsFinalCustomer
'neuen Datensatz anfügen
.AddNew

'Textfeldinhalt umkopieren
!strFinalName = Trim(txtFinalNa me.Value)

'Datensatz schreiben
.Update

'Recordset schliessen
.Close
End With

end_cmdSave
'Datenbankobjek te zerstören
db.Close
Set rsFinalCustomer = Nothing
Set db = Nothing

Exit Sub

err_cmdSave
MsgBox Err.Description
Resume end_cmdSpeicher n
End Sub
Private Sub Form_Close()

Forms!frmMaster Test!cboFinalCu stomer.Requery *
End Sub
Private Sub Form_Load()
Me!txtFinalName .SetFocus
Me!txtFinalName .Value = Me.OpenArgs

End Sub
--------

* here i get an Error "Item must be saved before requery"

I couldn't figure out where's my mistake/error in reasoning whole day.

Can anybody help me coming on the right way?

Volker

[1]Only names are stored not whole adresses. Just names and SAP number
[2]Our systems are limited in several functions so i try to get over
those limitations by using access - quotations themselves are
made with a web-tool based on SAP netweaver
--
Im übrigen bin ich der meinung, dass TCPA/TCG verhindert werden muss

Aug 1 '08 #2
Hi, Larry

Larry Linson wrote:
There are quite a number of examples... many
can be found by using http://groups.google.com to search the archives
here; others can be found in resources linked from my SharePoint page
at http://sp.ntpcug.org/accesssig/default.aspx (see the Resources
list on that same page).
Right, and some links were already given in the german newsgroup.
There is a sample in Rogers Access Library :

http://www.rogersaccesslibrary.com/d...=NotInList.mdb

This sample is very close to the requested needs - even though there is no
unbound form used.

But some prefer to follow their own ideas...

Regards
Jens
Aug 1 '08 #3
Jens Schilling wrote:
But some prefer to follow their own ideas...
No - Im asking to either get help or other/new ideas.

The idea with using an unbound form came up because i didn't have any idea
how to catch and handle input-errors when using a bound form.
Now .. "before update" and "after update" of both, form and control, are the
keywords I didn't hit on all the time since yesterday.

Sorry for asking such simple questions but sometimes there are days you do
not see the wood for trees... and then you just need a helpful person who
puts you right back an your way by just giving the right keywords.

Therefore: thank you, Larry.

Volker
--
Im übrigen bin ich der meinung, dass TCPA/TCG verhindert werden muss
Aug 2 '08 #4
Larry Linson wrote:
Perhaps there's a compelling reason, but I don't see why you do not
validate and edit the information in the Before Update and After Update
properties of the Controls and of the Form itself, and use a Bound Form.
Outch! These arte the keywords i dind't hit on since yesterday.

Thank you for just putting me back on the right way.
and return. There are quite a number of examples... many can be found by
using http://groups.google.com to search the archives here;
but only by typing the right keywords - an that's what i was missing.

I fully ran out of ideas, just had a hole in my head.
found in resources linked from my SharePoint page at
http://sp.ntpcug.org/accesssig/default.aspx (see the Resources list on
that same page).
Thank you for that link. I'll check it out on monday, in the bureau.

I think i need these two days without having to do too much with Access ;)

Volker
--
Im übrigen bin ich der meinung, dass TCPA/TCG verhindert werden muss
Aug 2 '08 #5
Hi,

Volker Neurath wrote:
Jens Schilling wrote:
>But some prefer to follow their own ideas...
No - Im asking to either get help or other/new ideas.
The idea with using an unbound form came up because i didn't have any
idea how to catch and handle input-errors when using a bound form.
I'm a bit disappointed regarding your own efforts.
What more do you need than the examples labeled as Option 5 or Option 6 in
the sample of Rogers Access Library ?
There is a form opened that gives you the ability to edit the data you have
entered to the combo box.

So - what's your problem ???

Do you need more samples regarding the "NotInList-Event"?

OK, here we go:

http://home.comcast.net/~cccsolutions/accesstips.html
Not In List Combobox (Forms)

http://www.datadynamicsnw.com/seattl.../downloads.htm
Not In List - Detailed Instructions by Tom Wickerath

http://www.databasedev.co.uk/downloads.html
Using the Combo Box's NotInList event with multiple fields

http://www.geocities.com/pmpg98_pt/NotInList.html
NotInList

http://www.access-programmers.co.uk/...ad.php?t=97434
MultiNotInList. zip by ChrisO - post no. 14

And at last a german sample

http://www.access-home.de/accbsp2.htm
Ereignis 'NotInList' eines Kombinationsfel des

Regards
Jens


Aug 2 '08 #6
Jens Schilling wrote:
I'm a bit disappointed regarding your own efforts.
Why? I can assure you: there's no need for.
What more do you need than the examples labeled as Option 5 or Option 6 in
the sample of Rogers Access Library ?
Sorry, yesterday evening i didn't explore any of those links yet. As i said
in my post above: I felt a had a hole in my head an being empty and at the
same time too full to get anything in.

Having slept a night over it I'm now of the opinion, i shouldn't have asked
here too - not before having explored all the links given in m.p.d.a.

I today had some short looks on some of them and what i've seen there looks
very auspicious to me - I'm shure now I will solve my "problem".

I put the blame on the fact that i felt a kind of exhaustion or so.
Cannot really describe my situtation yesterday.
Today it seems to me that yesterday I didn't even really know what I was
looking for :(
You know how this feels (at least when you realize it)?

As I said in the german group yesterday: it was my off day
(including: brain.enabled=f alse) :->
Do you need more samples regarding the "NotInList-Event"?

OK, here we go:

http://home.comcast.net/~cccsolutions/accesstips.html
Not In List Combobox (Forms)

http://www.datadynamicsnw.com/seattl.../downloads.htm
Not In List - Detailed Instructions by Tom Wickerath

http://www.databasedev.co.uk/downloads.html
Using the Combo Box's NotInList event with multiple fields

http://www.geocities.com/pmpg98_pt/NotInList.html
NotInList

http://www.access-programmers.co.uk/...ad.php?t=97434
MultiNotInList. zip by ChrisO - post no. 14
Thank you once again.
And at last a german sample

http://www.access-home.de/accbsp2.htm
Ereignis 'NotInList' eines Kombinationsfel des
I've downloaded their two examples at the bureau yesterday - shortly before
i left it. I'll study them on monday, like all the other links.

Today and tomorry i use for relaxation - it's badly necessary

Volker
--
Im übrigen bin ich der meinung, dass TCPA/TCG verhindert werden muss
Aug 2 '08 #7

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

Similar topics

3
2804
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? Say I have a Customers--Invoices relationship, and I want to be able to pick the Customer's name from a combobox. (keeps people from entering the same text - or worse, just almost the same - a zillion times). So I create a CustomerID, enforce...
1
2668
by: Alex.Wisnoski | last post by:
I have a data entry form with a combo box to look up an entrant's name. If the name is already in the table then it pulls up the record and that part of the form works fine. If the name isn't in the table then I want to be able to add it but this part is not working. I enter a name that is not in the table and press Enter. I step through the code and it appears to work until I get to "Exit Sub". At this point a warning message box...
2
2218
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" & i) .AfterUpdate = "=txtTechnology_Change(" & i & ")" .OnEnter = "=txtTechnology_OnEnter(" & i & ")" End With I can set events to a common routine for all the boxes, and in the
4
1805
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 (tblUserInfo). The query hits a look up table called (lulFirstNames). If the user DOESN'T find the name they want in the combo box, they will just type it in.
11
2796
by: my-wings | last post by:
I think I've painted myself into a corner, and I'm hoping someone can help me out. I have a table of books (tblBooks), which includes a field (strPubName) for Publisher Name and another field (strPubCity) for Publisher City. These two fields have a many-to-one relationship with tables, (tlkpPubName and tlkpPubCity) respectively. The lookup tables only have one field (strPubName and strPubCity), which is their primary key. I also have...
7
6055
by: Bryan | last post by:
I am trying to allow the user to add an item to a list if it is not found in a combobox. When the NotInList event is triggered I run a function "AddItem" that has a custom dialog box to add an item to the underlying table. The function either returns "Not Added", or the new Items ID. I know the function works fine. Whe I try the code below I get errors saying "Close action was cancelled" (referring to my custom popup input box), & ...
1
3696
by: JHite | last post by:
I am using Access 2003. My Form has 4 fields: MailingListID, auto generated – primary key LastName FirstName NickName I used the Combo box wizard to set up look-up box on the form. I answered the wizards question by saying “find a record in the form”, I choose the first 3 fields for the combo box and made field 1 width = 0. The wizard then created the unbound control box and generated the code shown below Private Sub...
2
1955
imrosie
by: imrosie | last post by:
Hello, I have a search form that uses a row query to locate a customer by customerID and first & last names, so it's an unbound control. I also have two events associated with this control, 'NotInList' (for customer not in table) and AfterUpdate event which (uses RecordsetClone by customeriD. The Recordsetclone event allows for the other data stored associated with the customer that's located. However, a strange thing occurs when a new...
4
4963
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: Mouse, Mickey Mickey Mouse When a person is added, the querys' underlying recordset is updated in the NotInList event. I can't figure out how to refresh the combobox to display the new person. I get the standard error message that the
0
8378
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,...
1
8577
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
8653
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7398
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
6206
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
4202
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
4376
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2786
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
2018
muto222
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.