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
item is not in the list. Here's my code:
....<in the NotInList event>...
With rst
.AddNew
!FirstName = strFirstName
!MiddleInitial = strMiddleInitia l
!LastName = strLastName
.Update
End With
Response = acDataErrAdded
I have to refresh the query somehow so that it displays in the combo
box. If I add the code:
Me.ComboBox.Req uery
I get the standard error message that it must be saved.
Maybe there's a better way to do this? Thanks for any help or advice. 4 4965
On Tue, 4 Mar 2008 11:09:22 -0800 (PST), EManning
<ma**********@h otmail.comwrote :
Your code, minus the Requery, looks correct. Perhaps you have On Error
Resume Next and you are suppressing errors?
-Tom.
>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 item is not in the list. Here's my code:
...<in the NotInList event>... With rst
.AddNew
!FirstName = strFirstName
!MiddleInitial = strMiddleInitia l
!LastName = strLastName
.Update End With
Response = acDataErrAdded
I have to refresh the query somehow so that it displays in the combo box. If I add the code:
Me.ComboBox.Req uery
I get the standard error message that it must be saved.
Maybe there's a better way to do this? Thanks for any help or advice.
The way it works for me is typing:
ComboBox.Requer y
I don't use the me. part because im running the code in the form
already.
Instead of using the requery on the combo box, try requerying the
From.
CurrentForm.Req uery
- GL
On Mar 5, 1:37*am, Tom van Stiphout <no.spam.tom7.. .@cox.netwrote:
On Tue, 4 Mar 2008 11:09:22 -0800 (PST), EManning
<manning_n...@h otmail.comwrote :
Your code, minus the Requery, looks correct. Perhaps you have On Error
Resume Next and you are suppressing errors?
-Tom.
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
item is not in the list. *Here's my code:
...<in the NotInList event>...
With rst
* *.AddNew
* *!FirstName = strFirstName
* *!MiddleInitial = strMiddleInitia l
* *!LastName = strLastName
* *.Update
End With
* * Response = acDataErrAdded
I have to refresh the query somehow so that it displays in the combo
box. *If I add the code:
* * Me.ComboBox.Req uery
I get the standard error message that it must be saved.
Maybe there's a better way to do this? *Thanks for any help or advice.-Hide quoted text -
- Show quoted text -
On Mar 5, 8:57*am, Guillermo_Lopez <g.lo...@iesdr. comwrote:
The way it works for me is typing:
* * *ComboBox.Reque ry
I don't use the me. part because im running the code in the form
already.
Instead of using the requery on the combo box, try requerying the
From.
* * *CurrentForm.Re query
- GL
On Mar 5, 1:37*am, Tom van Stiphout <no.spam.tom7.. .@cox.netwrote:
On Tue, 4 Mar 2008 11:09:22 -0800 (PST), EManning
<manning_n...@h otmail.comwrote :
Your code, minus the Requery, looks correct. Perhaps you have On Error
Resume Next and you are suppressing errors?
-Tom.
>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
>item is not in the list. *Here's my code:
>...<in the NotInList event>...
>With rst
* *.AddNew
* *!FirstName = strFirstName
* *!MiddleInitial = strMiddleInitia l
* *!LastName = strLastName
* *.Update
>End With
* * Response = acDataErrAdded
>I have to refresh the query somehow so that it displays in the combo
>box. *If I add the code:
* * Me.ComboBox.Req uery
>I get the standard error message that it must be saved.
>Maybe there's a better way to do this? *Thanks for any help or advice..- Hide quoted text -
- Show quoted text -- Hide quoted text -
- Show quoted text -
Any attempt to requery the combobox gives me an error that the field
must be saved, whether or not the "Me." is used. The form is unbound
so requerying it wouldn't do any good. Thanks for replying.
EManning wrote:
On Mar 5, 8:57 am, Guillermo_Lopez <g.lo...@iesdr. comwrote:
>>The way it works for me is typing:
ComboBox.Requer y
I don't use the me. part because im running the code in the form already.
Instead of using the requery on the combo box, try requerying the From.
CurrentForm.Req uery
- GL
On Mar 5, 1:37 am, Tom van Stiphout <no.spam.tom7.. .@cox.netwrote:
>>>On Tue, 4 Mar 2008 11:09:22 -0800 (PST), EManning
>>><manning_n.. .@hotmail.comwr ote:
>>>Your code, minus the Requery, looks correct. Perhaps you have On Error Resume Next and you are suppressing errors?
>>>-Tom.
>>>>I have a combobox whose rowsource is a union query. This query displays a person's name in "lastname, firstname" format and in "firstnam e 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 item is not in the list. Here's my code:
>>>>...<in the NotInList event>... With rst .AddNew !FirstName = strFirstName !MiddleInitial = strMiddleInitia l !LastName = strLastName .Update End With
>>> Response = acDataErrAdded
>>>>I have to refresh the query somehow so that it displays in the combo box. If I add the code:
>>> Me.ComboBox.Req uery
>>>>I get the standard error message that it must be saved.
>>>>Maybe there's a better way to do this? Thanks for any help or advice.- Hide quoted text -
>>>- Show quoted text -- Hide quoted text -
- Show quoted text -
Any attempt to requery the combobox gives me an error that the field
must be saved, whether or not the "Me." is used. The form is unbound
so requerying it wouldn't do any good. Thanks for replying.
Here's some code I wrote for 2 comboxes. I didn't have a recordsource
for the form using the code for Combo0. I added a recordsource for the
code in Combo3.
'Combo0_NotInLi st works just fine.
Private Sub Combo0_NotInLis t(NewData As String, Response As Integer)
Dim rst As Recordset
Set rst = CurrentDb.OpenR ecordset("Table 1", dbOpenDynaset)
If MsgBox("Make this a new entry?", vbYesNo, "Confirm Add") = vbYes
Then
rst.AddNew
rst!TextF = NewData
rst.Update
Response = acDataErrAdded
Else
Response = acDataErrContin ue
End If
rst.Close
Set rst = Nothing
End Sub
'Combo3_NotInLi st works just fine.
'Add record by entering firstname space lastname
'I use a query for the combo's rowsource. The combo has 2 columns; ID
'and Fullname. Fullname is a concatenation of first and last names.
'The SQL is
'SELECT DISTINCTROW Table1.ID, [FirstName] & " " & [LastName] AS
FullName FROM Table1;
Private Sub Combo3_NotInLis t(NewData As String, Response As Integer)
Dim rst As Recordset
Set rst = CurrentDb.OpenR ecordset("Table 1", dbOpenDynaset)
Dim sF As Variant
Dim sL As Variant
Dim iP As String
iP = InStr(NewData, " ")
If iP 0 Then
sF = Left(NewData, iP - 1)
sL = Mid(NewData, iP + 1)
Else
sF = NewData
End If
If MsgBox("Not in list. Make this a new entry?", vbYesNo, "Confirm
Add") = vbYes Then
rst.AddNew
rst!FirstName = sF
rst!LastName = sL
rst.Update
Response = acDataErrAdded
Else
Response = acDataErrContin ue
End If
rst.Close
Set rst = Nothing
End Sub
Fur http://www.youtube.com/watch?v=BPv0qCg4so8 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mark Kola |
last post by:
I have ran into an interesting situation. I have a calculated field
based on a combobox column that somtimes is not requerying when I
change the combo box value.
Combobox
cboCustomer
2 Columne - Widths 1;0 - LimitToList = Yes
Calculated TextBox -
ControlSource =cboCustomer.Column(1)
|
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
|
by: Thelma Lubkin |
last post by:
I am trying to limit the user's options to the choices offered by the
combobox text, but I don't want this to extend to how he spaces out
the text, e.g.
'abcdefg' and 'ab cd efg'
should be equivalent. I know how to compare strings to see whether
they meet this criterion--I don't know how to let the combobox know
that this is what I want.
I am thinking of dealing w/ this in the NotInList_event, but I don't
know how to get to the...
|
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.
|
by: Stephen.Hunter |
last post by:
Hello Everybody (anybody)?
I am trying to appent a combobox to include data entered by a user
which is Not In List. I have came accross this code from Allen Browne
which seems to be what I am looking for can anybody tell me if I have
to change any of the code below to match field names or combobox name
from my own database.
Thanks in advance for any help with this topic?
| |
by: Hiroyuki Tanaka |
last post by:
Hi All,
I am trying to develop an application for a touch screen using buttons
for the numeric pad with Completion ComboBoxes.
At the moment I am having a problem sending the button presses to my
Completion ComboBox using sendkey.wait. From the keyboard (that will
not exist for my final application) I can enter text into my
Completion and the selection completes as expected.
|
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 a group of teachers--who
are not computer teachers.
I have a main form named "frmProgressReports" based on a record source
"qryStudents," which has StudentID, FullName: & " " &
, LastName, and FirstName.
|
by: steph |
last post by:
Hi,
Access 2002: We've got a DataSheet-Form with a Combobox-field that
shows strange behaviour.
The ComboBox is constrained to the list so if we paste a value not
existing in the list we get a Not-in-list-error. But sometimes we also
get this error when pasting items which are part of the list.
Sometimes, not allways. It is not comprehensible for me what's
different for the strings where it works.
|
by: genojoe |
last post by:
The Microsoft Access comboBox control has a LimitToList property and a
NotInList event. Can someone point me to code samples that cleanly emulates
these control features from Access?
All of the things I tried seem to be sloppy coding practice.
|
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,...
|
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...
| |
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...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |