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

List box Requery is one record behind all the time

Hi

I have a list box which I refresh by changing the .rowsource and doing
a requery after adding a record to the table:

QryOrderDetail = "SELECT [TblOrderDetail].[OrderDetailId],
[TblOrderDetail].[LUOrderId], [TblOrderDetail].[OrderDetailQty],
[TblOrderDetail].[OrderDetailDescription],
[TblOrderDetail].[OrderDetailPrice],
[TblOrderDetail].[OrderDetailFor],
[TblOrderDetail].[OrderDetailDelivered] FROM [TblOrderDetail] WHERE
(((TblOrderDetail.LUOrderId)= " & ([TbxOrderId].[Value]) & ")) ORDER
BY [OrderDetailId]"
LstBxOrderDetail.RowSource = QryOrderDetail
DoCmd.Requery "LstBxOrderDetail"

The problem is that the listbox displays nothing after the first
record is added, the first record after the second is added, etc.

Doing a .Refesh or .Repaint does not help. If I add a MsgBox(vbokonly)
displaying QryOrderDetail before doing the requery it displys
correctly but this is annoying.

Does anybody have any hints?
Nov 13 '05 #1
2 1508
he******@hotmail.com (Hansen) wrote:
Hi

I have a list box which I refresh by changing the .rowsource and doing
a requery after adding a record to the table:

QryOrderDetail = "SELECT [TblOrderDetail].[OrderDetailId],
[TblOrderDetail].[LUOrderId], [TblOrderDetail].[OrderDetailQty],
[TblOrderDetail].[OrderDetailDescription],
[TblOrderDetail].[OrderDetailPrice],
[TblOrderDetail].[OrderDetailFor],
[TblOrderDetail].[OrderDetailDelivered] FROM [TblOrderDetail] WHERE
(((TblOrderDetail.LUOrderId)= " & ([TbxOrderId].[Value]) & ")) ORDER
BY [OrderDetailId]"
LstBxOrderDetail.RowSource = QryOrderDetail
DoCmd.Requery "LstBxOrderDetail"

The problem is that the listbox displays nothing after the first
record is added, the first record after the second is added, etc.

Doing a .Refesh or .Repaint does not help. If I add a MsgBox(vbokonly)
displaying QryOrderDetail before doing the requery it displys
correctly but this is annoying.

Does anybody have any hints?


Perhaps it helps if you insert

Me.Dirty = False

in front of your code.
HTH
Matthias Kläy
--
www.kcc.ch

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Nov 13 '05 #2
What happens when you replace DoCmd.Requery... with
LstBxOrderDetail.Requery? Also, at what point are you executing the
code above, i.e., is it called from a particular form or control event?
This code should work fine from the form's afterupdate event.

Bruce

Nov 13 '05 #3

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

Similar topics

1
by: Chicken Kebab Abdullah | last post by:
I am making a database of my movie collection and I have a form which Shows a DVD Code in a combo, and a list of the divx movies on the dvd on the right in a list box. The combo boxes bound...
20
by: MS | last post by:
Access 97 I want to requery the data being displayed on a form, then I want to return to the record I was in. Why doesn't this code work? Private Sub CmdRefsh_Click()
5
by: PeteCresswell | last post by:
Anybody seen such a thing? My guys want to build a list of mutual funds to drive a report, but they want to be able to sequence the funds on the list so that I can determine what sequence they...
8
by: sara | last post by:
I am learning Access and programming. I wanted to have the user select the departments for an ad from the list of all departments. Found code (that I could understand) on this site, and it works....
22
by: Br | last post by:
First issue: When using ADPs you no longer have the ability to issue a me.refresh to save the current record on a form (the me.refresh does a requery in an ADP). We usually do this before...
6
by: AA Arens | last post by:
Hi, I have a database with 2 main forms. Contacts and companies. I share the base with two others via LAN. On the companies form I have buttons to navigate throught the records (>400). We are...
6
by: MarkoBBC | last post by:
Hi everyone, First a brief description of my form: I have a subform within a main form. In my subform, I have a listbox displaying address information by firm name. A user first has to select a...
8
by: jadeverell | last post by:
Hi, I have a form which contains some dates and some calculated fields based on these dates e.g. Days until contract expires (difference between today and contract end date) etc....I also have an...
6
by: woodey2002 | last post by:
Hi Everyone. Thanks for your time. I am trying to create a search form that will allow users to select criteria from multiple multi select boxes. So far i have managed to achieve a search option...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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.