473,516 Members | 2,889 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Records added with ADo don't show up in query immediately

Hi all,

I am relatively new to ADO, but up to now I got things working the way
I wanted. But now I've run into somethng really annoying.

I am working in MS Access. I am using an Access frontend separately
from a backend. The tables from the backend database are linked in the
frontend database.
In the frontend there is a Form with a listbox in it. The listbox
rowsource is a query that selects all the records from a (linked)
table. Via this form I am adding new records to the table, and for this

I am using a ADO Connection and Recordset. The data is added to the
table via the AddNew and Update Methods of the recordset.
Now, when I Requery the Listbox in the form straight after the adding
of the record, I will not see the newly added record. It will take a
short time, from one second up to 3 seconds before I will see the newly

added record via a Requery of the Listbox. Which is very annoying, as
you can imagine.
I've got two possibilities to avoid this problem, both of which I have
not been able to find:
1) Perform a check to find when the data is 'really' added to the
database so i can then perform the requery.
2) force the recordset, connection or whatever to immediatly write the
data to the table and 'release' it for other queries to see, so I know
for sure my Requery will give the proper data.
Any help will be much appreciated!
Greetings,
Gerben.

Dec 28 '06 #1
6 2759
Hi, Gerben.
Via this form I am adding new records to the table, and for this
I am using a ADO Connection and Recordset. The data is added to the
table via the AddNew and Update Methods of the recordset.
Using Recordsets for data manipulation is the "last resort." You must have a
really, really good reason to avoid bound forms or SQL, because it's extra work
and it's slow.
It will take a
short time, from one second up to 3 seconds before I will see the newly
added record via a Requery of the Listbox.
That means you're connecting to the linked tables in the current database file,
or you're connecting to the tables located across the network and your network
is rather fast, or you have a lot of data being pulled across the network.
Connecting across the network can take up to five seconds with that built-in
delay from having multiple connections.
I've got two possibilities to avoid this problem, both of which I have
not been able to find:
1) Perform a check to find when the data is 'really' added to the
database so i can then perform the requery.
2) force the recordset, connection or whatever to immediatly write the
data to the table and 'release' it for other queries to see, so I know
for sure my Requery will give the proper data.
Are you sure you can't use a bound form and a list box with a row source that
uses a query on the linked tables so that you can just requery the list box as
needed, with instant or near instant results displayed?

There are also ways to optimize list boxes and combo boxes, but it sounds like
you've got several design problems that need to be addressed first, where
Recordset usage is only one of them. Do you have indexes on the join columns,
the criteria columns, and the sort columns in the query used to populate the
list box?

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact info.
"gerbski" <ge*****@holland.aswrote in message
news:11**********************@42g2000cwt.googlegro ups.com...
Hi all,

I am relatively new to ADO, but up to now I got things working the way
I wanted. But now I've run into somethng really annoying.

I am working in MS Access. I am using an Access frontend separately
from a backend. The tables from the backend database are linked in the
frontend database.
In the frontend there is a Form with a listbox in it. The listbox
rowsource is a query that selects all the records from a (linked)
table. Via this form I am adding new records to the table, and for this

I am using a ADO Connection and Recordset. The data is added to the
table via the AddNew and Update Methods of the recordset.
Now, when I Requery the Listbox in the form straight after the adding
of the record, I will not see the newly added record. It will take a
short time, from one second up to 3 seconds before I will see the newly

added record via a Requery of the Listbox. Which is very annoying, as
you can imagine.
I've got two possibilities to avoid this problem, both of which I have
not been able to find:
1) Perform a check to find when the data is 'really' added to the
database so i can then perform the requery.
2) force the recordset, connection or whatever to immediatly write the
data to the table and 'release' it for other queries to see, so I know
for sure my Requery will give the proper data.
Any help will be much appreciated!
Greetings,
Gerben.

Dec 28 '06 #2
Hi, Gerben.

For more information about improving performance in multiuser databases, please
see the following Web page for a link to Access MVP Tom Wickerath's article,
"Implementing a Successful Multiuser Access/JET Application":

http://www.Access.QBuilt.com/html/articles.html

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact info.
"'69 Camaro" <Fo**************************@Spameater.orgZERO_SP AMwrote in
message news:5t******************************@adelphia.com ...
Hi, Gerben.
>Via this form I am adding new records to the table, and for this
I am using a ADO Connection and Recordset. The data is added to the
table via the AddNew and Update Methods of the recordset.

Using Recordsets for data manipulation is the "last resort." You must have a
really, really good reason to avoid bound forms or SQL, because it's extra
work and it's slow.
>It will take a
short time, from one second up to 3 seconds before I will see the newly
added record via a Requery of the Listbox.

That means you're connecting to the linked tables in the current database
file, or you're connecting to the tables located across the network and your
network is rather fast, or you have a lot of data being pulled across the
network. Connecting across the network can take up to five seconds with that
built-in delay from having multiple connections.
>I've got two possibilities to avoid this problem, both of which I have
not been able to find:
1) Perform a check to find when the data is 'really' added to the
database so i can then perform the requery.
2) force the recordset, connection or whatever to immediatly write the
data to the table and 'release' it for other queries to see, so I know
for sure my Requery will give the proper data.

Are you sure you can't use a bound form and a list box with a row source that
uses a query on the linked tables so that you can just requery the list box as
needed, with instant or near instant results displayed?

There are also ways to optimize list boxes and combo boxes, but it sounds like
you've got several design problems that need to be addressed first, where
Recordset usage is only one of them. Do you have indexes on the join columns,
the criteria columns, and the sort columns in the query used to populate the
list box?

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact info.
"gerbski" <ge*****@holland.aswrote in message
news:11**********************@42g2000cwt.googlegro ups.com...
>Hi all,

I am relatively new to ADO, but up to now I got things working the way
I wanted. But now I've run into somethng really annoying.

I am working in MS Access. I am using an Access frontend separately
from a backend. The tables from the backend database are linked in the
frontend database.
In the frontend there is a Form with a listbox in it. The listbox
rowsource is a query that selects all the records from a (linked)
table. Via this form I am adding new records to the table, and for this

I am using a ADO Connection and Recordset. The data is added to the
table via the AddNew and Update Methods of the recordset.
Now, when I Requery the Listbox in the form straight after the adding
of the record, I will not see the newly added record. It will take a
short time, from one second up to 3 seconds before I will see the newly

added record via a Requery of the Listbox. Which is very annoying, as
you can imagine.
I've got two possibilities to avoid this problem, both of which I have
not been able to find:
1) Perform a check to find when the data is 'really' added to the
database so i can then perform the requery.
2) force the recordset, connection or whatever to immediatly write the
data to the table and 'release' it for other queries to see, so I know
for sure my Requery will give the proper data.
Any help will be much appreciated!
Greetings,
Gerben.


Dec 28 '06 #3

'69 Camaro wrote:
Using Recordsets for data manipulation is the "last resort." You must have a
really, really good reason to avoid bound forms or SQL, because it's extra work
and it's slow.
First of all: thank you for your comments. They are food for thought...

I have a very good reason for unbound forms and data manipulation with
recordsets I have had very bad experiences with bound forms in which
data entry was tricky and hard to get to behave like I wanted. With
unbound forms I can let my controls behave any way I want to, let the
user enter data, and before I add the data to the database I can
perform any check I want to. So while your comments are valuable
comments, I prefer to stick with unbound forms.
That means you're connecting to the linked tables in the current database file,
or you're connecting to the tables located across the network and your network
is rather fast, or you have a lot of data being pulled across the network.
Connecting across the network can take up to five seconds with that built-in
delay from having multiple connections.
To be precise: I am working on a development environment where
everything is local, but have to port it eventually to a network
environment. Hence the separate backend and frontend and hence the use
of ADO. But right now this problem is showing up on a front-end to
back-end connection where both databases are in the smae folder on my
harddisk.
I am not pulling a lot of data over this connection: it is a table with
6 columns (4 text of lenghts 35, 35, 2, and 12, 1 boolean and 1
autonumber) which has 232 rows. Not something that would give rise to
performance problems.

Are you sure you can't use a bound form and a list box with a row source that
uses a query on the linked tables so that you can just requery the list box as
needed, with instant or near instant results displayed?
Yes, I could, but I don't want to ;-)
>
There are also ways to optimize list boxes and combo boxes, but it sounds like
you've got several design problems that need to be addressed first, where
Recordset usage is only one of them. Do you have indexes on the join columns,
the criteria columns, and the sort columns in the query used to populate the
list box?
There are some indexe on the table, and in fact the query for the
listbox just references this one table: no connection with other
tables, and no criteria to filter the data. I do use sorting, but once
the new record has popped up in my list that sorting is almost
instantaneously. So I don't think the problem lies in that area.
HTH.
Gunny
Thanks for your comments, I will surely look at the link you gave me
and see if I can find something there. In the menatime, if there are
any other suggestions: they are still most welcome....

Gerben.

Dec 30 '06 #4
"gerbski" <ge*****@holland.aswrote in
news:11**********************@k21g2000cwa.googlegr oups.com:
>
....
>
I have a very good reason for unbound forms and data
manipulation with recordsets I have had very bad experiences
with bound forms in which data entry was tricky and hard to
get to behave like I wanted.
I think the problem you had was that you did not know the
correct process to get the data entry smooth on an unbound form.
With unbound forms I can let my
controls behave any way I want to, let the user enter data,
and before I add the data to the database I can perform any
check I want to.
I can easily achieve the same using bound forms.
>Are you sure you can't use a bound form and a list box with a
row source that uses a query on the linked tables so that you
can just requery the list box as needed, with instant or near
instant results displayed?

Yes, I could, but I don't want to ;-)
If you are normal, you don't want to pay income taxes either.
Not wanting doesn't mean you can do as you please without
suffering the consequences.

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Dec 30 '06 #5
Hi.
I am not pulling a lot of data over this connection: it is a table with
6 columns (4 text of lenghts 35, 35, 2, and 12, 1 boolean and 1
autonumber) which has 232 rows. Not something that would give rise to
performance problems.
So if you're having performance problems in a single user environment, imagine
how much more of a problem this is going to be when many other users are
grabbing the data from across the network. Eventually, you are going to have to
find ways to speed up the data operations, no matter how reluctant you are at
the moment to move away from Recordsets. However, the link I gave you to Tom
Wickerath's article should help to some degree, even if you're using Recordsets.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact info.
"gerbski" <ge*****@holland.aswrote in message
news:11**********************@k21g2000cwa.googlegr oups.com...
>
'69 Camaro wrote:
>Using Recordsets for data manipulation is the "last resort." You must have a
really, really good reason to avoid bound forms or SQL, because it's extra
work
and it's slow.

First of all: thank you for your comments. They are food for thought...

I have a very good reason for unbound forms and data manipulation with
recordsets I have had very bad experiences with bound forms in which
data entry was tricky and hard to get to behave like I wanted. With
unbound forms I can let my controls behave any way I want to, let the
user enter data, and before I add the data to the database I can
perform any check I want to. So while your comments are valuable
comments, I prefer to stick with unbound forms.
>That means you're connecting to the linked tables in the current database
file,
or you're connecting to the tables located across the network and your
network
is rather fast, or you have a lot of data being pulled across the network.
Connecting across the network can take up to five seconds with that built-in
delay from having multiple connections.

To be precise: I am working on a development environment where
everything is local, but have to port it eventually to a network
environment. Hence the separate backend and frontend and hence the use
of ADO. But right now this problem is showing up on a front-end to
back-end connection where both databases are in the smae folder on my
harddisk.
I am not pulling a lot of data over this connection: it is a table with
6 columns (4 text of lenghts 35, 35, 2, and 12, 1 boolean and 1
autonumber) which has 232 rows. Not something that would give rise to
performance problems.

>Are you sure you can't use a bound form and a list box with a row source that
uses a query on the linked tables so that you can just requery the list box
as
needed, with instant or near instant results displayed?

Yes, I could, but I don't want to ;-)
>>
There are also ways to optimize list boxes and combo boxes, but it sounds
like
you've got several design problems that need to be addressed first, where
Recordset usage is only one of them. Do you have indexes on the join
columns,
the criteria columns, and the sort columns in the query used to populate the
list box?

There are some indexe on the table, and in fact the query for the
listbox just references this one table: no connection with other
tables, and no criteria to filter the data. I do use sorting, but once
the new record has popped up in my list that sorting is almost
instantaneously. So I don't think the problem lies in that area.
>HTH.
Gunny

Thanks for your comments, I will surely look at the link you gave me
and see if I can find something there. In the menatime, if there are
any other suggestions: they are still most welcome....

Gerben.

Jan 1 '07 #6
"gerbski" <ge*****@holland.aswrote in message
<11**********************@42g2000cwt.googlegroups. com>:
Hi all,

I am relatively new to ADO, but up to now I got things working the
way I wanted. But now I've run into somethng really annoying.

I am working in MS Access. I am using an Access frontend separately
from a backend. The tables from the backend database are linked in
the frontend database.
In the frontend there is a Form with a listbox in it. The listbox
rowsource is a query that selects all the records from a (linked)
table. Via this form I am adding new records to the table, and for
this

I am using a ADO Connection and Recordset. The data is added to the
table via the AddNew and Update Methods of the recordset.
Now, when I Requery the Listbox in the form straight after the adding
of the record, I will not see the newly added record. It will take a
short time, from one second up to 3 seconds before I will see the
newly

added record via a Requery of the Listbox. Which is very annoying, as
you can imagine.
I've got two possibilities to avoid this problem, both of which I
have not been able to find:
1) Perform a check to find when the data is 'really' added to the
database so i can then perform the requery.
2) force the recordset, connection or whatever to immediatly write
the data to the table and 'release' it for other queries to see, so I
know for sure my Requery will give the proper data.
Any help will be much appreciated!
Greetings,
Gerben.
This is a known phenomena with ADO/Jet OLEDB. Here's an article about
it http://support.microsoft.com/kb/200300

Basically, if you perform the operations on the same connection, the
changes should be available.

If you're completely unbound, then you could first fire of the action
query, then open a/the recordset to populate the combo on the same
connection, and it should be available.

But I'm not sure I understand the need to go unbound. I mean, Access
is designed for bound approaches, and does that extremely well.

--
Roy-Vidar
Jan 1 '07 #7

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

Similar topics

6
2402
by: Jamie Fryatt | last post by:
Hi everyone, here's what id like to do. I have a table with 2 fields, name and value I need to be able to add multiple records quickly, for example I need to add name value abc 1 abc 2 abc 3
20
40041
by: Guru | last post by:
Hi I have a table which contains number of rows. I want to fetch the last 5 records from the table. I know for the first 'n' records we can use FETCH FIRST n ROWS ONLY command. But i want to fetch last 5 records. Can any one help in this...
2
3866
by: Shaiguy | last post by:
I have a table containing the following fields: ProjectUpdateID (PrimaryKey) ProjectID UpdateDate I would like to create a Query in Ms Access 2000 which will return me the most recent 2 records (and also show the above 3 fields) So suppose the table looks like this:
3
8561
by: CSDunn | last post by:
Hello, I have an Access 2000 Project in which the data comes from a SQL Server 2000 database, and multiple users need to be able to see new records as each user adds records. The users also need to be aware of updates as they are made to current records. The data the users are looking at is presented in a subform that has the Default View...
3
6098
by: mark | last post by:
How do I get all fields on one page of a report? I have a report that has a column for each day of the week and 6 records for each day. I need each weekday's records returned on only one detail page. Instead I am getting a new table layout for each day of the week. I have tried grouping on every record and combination I can, manipulating the...
1
4966
by: PMBragg | last post by:
ORINGINAL Post >Thank you in advance. I'm trying to pull all inventory items from December >of the previous year back to 4 years for my accountant. I know this can be >done, but I'm drawing a blank. I've tried; > >DateDiff("y",-4,DateIn) and get errors > >Please any assistance would be greatly appreciated. >
6
2496
by: Robin S. | last post by:
**Eric and Salad - thank you both for the polite kick in the butt. I hope I've done a better job of explaining myself below. I am trying to produce a form to add products to a table (new products). Tables: tblCategoryDetails CategoryID SpecID
13
3441
by: Jan | last post by:
Hi I have a database that I use to keep track of the sales promotions that we send to companies. I normally send a mailing based on a subset of the companies in the database (found using the query: QryICTMassDistribution3) , I then use a form and the code below to create a new record in the corrispondence table to show what...
7
1984
by: Ron | last post by:
Hi All, Using Access2000, winXP. Table 1 = tblClients displayed on frmClients via qryClients. 2nd table = tblInvoices shown on frmInvoices via qryInvoices. 2nd table = tblDetails shown on subform(to frmInvoices) sfrmDetails via qryDetails. Relationship built between tblClients/tblInvoices/tblDetails by ClientID. Relationship between...
0
7276
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7182
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...
1
7142
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...
0
7548
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...
1
5110
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...
0
4773
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...
0
3267
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...
0
1624
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
1
825
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.