473,513 Members | 6,210 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Requery Problem - [how to rebuild nested queries]

Hi all,

I have a form (*) based on a query (let's call it qryOuter). qryOuter
is based on resultset from qryInner which I am adding filters to and
rebuilding via QueryDefs.

When I then requery the form, these changes of the nested query do not
take - I have to close the form and reopen it. Is there a way to
refresh the form's rowsource i code to force it to "reconsider" the
underlying query without having to close the form?

thanks in advance
Axel
(*) to tell the truth its actually 2 continuous subforms which are
synchronized through qryInner and scroll together. So I actually
requery these 2. But I call a popup from the parent form for building
the filter then requery once I haved return back to main form.

Apr 26 '06 #1
2 2255
more info:

I meant to write RecordSource not RowSource.

I have tried to delete the (sub)forms recordsource query and refreshing
querydefs but that did not help either:

sQuery = Me.RecordSource
sSQL = CurrentDb.QueryDefs(sQuery).SQL
CurrentDb.QueryDefs.delete sQuery

Set qd1 = CurrentDb.CreateQueryDef(sQuery, sSQL)
CurrentDb.QueryDefs.Refresh
Me.Filter
Me.Requery

The sSQL contains references to qryInner (which was rebuilt) but
doesn't use the new version of qryInner...

any ideas?

Apr 26 '06 #2
one solution I found (although its not very nice) - if anybody can come
up with a better solution please post!

within the subform I created a function that removes the recordsource
query, then I refresh querydefs, afterwards I re-Add the Recourdsource
query. I would say only the act of re-binding the recordsource gets rid
of the cached version of the query.

Public Function refreshQuery()
Dim sQuery As String

sQuery = Me.RecordSource
Me.RecordSource = ""
CurrentDb.QueryDefs.Refresh
Me.RecordSource = sQuery
Me.Requery
refreshQuery = True
End Function

Apr 26 '06 #3

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

Similar topics

5
11102
by: ahokdac-sql | last post by:
Hi, I'm adapting access queries to sql server and I have difficulties with the following pattern : query1 : SELECT * FROM Query2 WHERE A=@param1 query 2: SELECT * FROM Table2 WHERE B=@param2 ...
3
2373
by: pbbriggs | last post by:
I will try to be as descriptive as possible, but this error has me stumped and I am not sure what relevant info to include.... I am running Access XP on a Windows XP machine. I initially began...
4
6969
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the...
4
6907
by: deko | last post by:
I'm a little nervous about slamming my database with a dozen Update queries in a loop that all modify RecordSources of open forms. Will the use of DoEvents and/or a Sleep function ameliorate any...
2
6801
by: Gilz | last post by:
Hi Hope someone can help this is driving me round the bend. I have a form called "frmMain_People" with a tab control on it with 2 sub forms called "fsubMain_People_Enquiries_Live" and...
11
7130
by: mrowe | last post by:
I am using Access 2003. (I am also using ADO in the vast majority of my code. I recently read a post that indicated that ADO is not all that is was initially cracked up to be. In the back of my...
8
2005
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...
10
7143
beacon
by: beacon | last post by:
Hi everybody, This is probably going to sound unorthodox, but I have to log records that are deleted...I know, go figure. Anyway, I have a form with a (continuous) subform, and on the subform I...
31
6630
by: matthewslyman | last post by:
I have an unusual design and some very unusual issues with my code... I have forced Access to cooperate on everything except one issue - record deletion. My form design involves a recursively...
0
7153
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
7373
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,...
1
7094
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...
0
4743
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...
0
3230
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...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1585
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 ...
1
796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
452
bsmnconsultancy
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...

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.