473,405 Members | 2,141 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,405 software developers and data experts.

Listbox doesn't update on Requery

Hello.

I have a listbox whose rowsource is set to a saved query (call it
"qry_customer_list.") When I add customers to my database, I call the
listbox Requery method so that the listbox will display the customers that I
added. Unfortunately, the listbox display does not change. If I close the
form and reload it, then the listbox will show the new customers.

Any suggestions on how to fix this?

Someone suggested there might be a timing issue where my listbox Requery
happens before the database insert is completed. I tested this by adding a
command button to call the listbox Requery method. I tried the command
button numerous times after adding a customer, and the customer still did
not show up in the listbox.

Suggestions?

Thanks
-Mark
Feb 17 '06 #1
6 9896
I take it that you are adding an entry because you went to the listbox and
the entry wasn't there. If that is the case, manually type the entry into
the listbox and let the NotInList event activate. In this event, you can add
the item you just typed in to a new record in the listbox's recordset or
pop-up a form to fill out the rest of the record is that is needed. Once
you've added the record, use the command

Response = acDataErrAdded

to tell the listbox that new data has been added to the recordset for its
RowSource. The listbox will automatically update itself.

Example:
http://www.mvps.org/access/forms/frm0015.htm

--
Wayne Morgan
MS Access MVP
"Mark" <no****@thanksanyway.org> wrote in message
news:W_******************************@w-link.net...
Hello.

I have a listbox whose rowsource is set to a saved query (call it
"qry_customer_list.") When I add customers to my database, I call the
listbox Requery method so that the listbox will display the customers that
I added. Unfortunately, the listbox display does not change. If I close
the form and reload it, then the listbox will show the new customers.

Any suggestions on how to fix this?

Someone suggested there might be a timing issue where my listbox Requery
happens before the database insert is completed. I tested this by adding a
command button to call the listbox Requery method. I tried the command
button numerous times after adding a customer, and the customer still did
not show up in the listbox.

Suggestions?

Thanks
-Mark

Feb 17 '06 #2
"Wayne Morgan" <co***************************@hotmail.com> wrote:
I take it that you are adding an entry because you went to the listbox and
the entry wasn't there. If that is the case, manually type the entry into
the listbox and let the NotInList event activate.


This is a listbox control, not a combobox. I am adding data to the database,
and that data would be returned by the listbox's underlying rowsource.
I want the listbox to refresh and display the new data. That doesn't
happen, not even when I execute the listbox's Requery method.

Thanks
-Mark
Feb 17 '06 #3
Mark, what is the timing of this?

How are you adding record's to the list box's RowSource table?
- Executing an Append query?
- Adding to a Recordset? - ADO or DAO?
- Entering into a Form?

Are you sure the record has been written before the requery? For example, is
it still in the form (not saved) when the Requery happens?

Does adding a DoEvents give it the chance to catch up?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mark" <no****@thanksanyway.org> wrote in message
news:aq********************@w-link.net...
"Wayne Morgan" <co***************************@hotmail.com> wrote:
I take it that you are adding an entry because you went to the listbox and
the entry wasn't there. If that is the case, manually type the entry into
the listbox and let the NotInList event activate.


This is a listbox control, not a combobox. I am adding data to the
database,
and that data would be returned by the listbox's underlying rowsource.
I want the listbox to refresh and display the new data. That doesn't
happen, not even when I execute the listbox's Requery method.

Feb 17 '06 #4
"Mark" <no****@thanksanyway.org> wrote:

Sorry, the problem is not what I thought it was. Apparently my code
wasn't applying the update to the database, so there was nothing
new for the listbox to retrieve when I executed its Requery method.

Thanks for your help.
-Mark
Feb 17 '06 #5
Sorry Allen, it was a goof on my part. My database insert
code wasn't doing what I thought it was doing.

-Mark
Feb 17 '06 #6
> This is a listbox control, not a combobox.

Sorry, bad reading.

--
Wayne Morgan
MS Access MVP
"Mark" <no****@thanksanyway.org> wrote in message
news:aq********************@w-link.net...
"Wayne Morgan" <co***************************@hotmail.com> wrote:
I take it that you are adding an entry because you went to the listbox and
the entry wasn't there. If that is the case, manually type the entry into
the listbox and let the NotInList event activate.


This is a listbox control, not a combobox. I am adding data to the
database,
and that data would be returned by the listbox's underlying rowsource.
I want the listbox to refresh and display the new data. That doesn't
happen, not even when I execute the listbox's Requery method.

Thanks
-Mark

Feb 17 '06 #7

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

Similar topics

5
by: Lukelrc | last post by:
Hi, I have a dynamically created listbox. I'm trying to get one of the options selected according to a passed value. This is what i have: <select name="txtTheme" id="txtTheme"> ...
4
by: Kyralessa | last post by:
In Access 2000, I have a base form with a ListBox of conference registrants. In the form's declarations section I include Dim f as Form To add a registrant I'm doing this: Set f = New...
1
by: M Wells | last post by:
Hi All, I am developing an Access 2003 project application with the back end in SQL Server 2003. I have a master form that tracks projects, and several subforms on it that track various...
4
by: N. Graves | last post by:
Hello... thank you for your time. I have a form that has a List box of equipotent records and a sub form that will show the data of the equipment select from the list box. Is it possible to...
3
by: reality_x | last post by:
Hello, Forgive me if I don't know the proper terminology. I have two listboxes on a form -- one listbox with values in which users can select from and one listbox blank. Upon clicking on a...
6
by: AAJ | last post by:
Hi all I have a listbox on a form. If I set its rowsource directly, and the query in the rowsourse returns no data, then the displayed listbox is empty (exactly as you would expect) ...
1
by: ANDRESUK | last post by:
All I have a listbox in a form footer. When the form footer is visible the listbox requeries fine but when I turn the form footer visible=false the listbox does not requery at all. What I am...
2
by: Chucara | last post by:
Hi, I'm trying to build a simple search in Access. I'll just give a simplified example, as I think I can solve the problem, if you can help me with this subproblem.. I have 2 listboxes -...
3
by: deejayquai | last post by:
Hello Simple one this I guess, but I'm quite stuck at the moment. I would like to update the records displayed in my listbox (lstStudents) using criteria selected from my combo (cboForm) in a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.