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

Requery of form based on saved query...

Hi all,

Using Access 2000 on XP Pro PC.

I have a form that is based on a presaved query - all fine with this.

I also have a refresh button that takes the values from various unbound
controls on the form and uses them a the criteria for changing the
query definition that the form is based on - so far so good.

The final line of code behind the refresh is me.requery to refresh the
dataset.

The refresh does not seem to recognise the changed query definition and
reports the previous values.

However, if I manually open the control source query from the form
properties, I can preview the dataset and then on closing the control
source query the form reports the correct values.

What am i doing wrong here?

Many thanks,

Rob.

Nov 13 '05 #1
2 3647
dkintheuk wrote:
Hi all,

Using Access 2000 on XP Pro PC.

I have a form that is based on a presaved query - all fine with this.

I also have a refresh button that takes the values from various unbound
controls on the form and uses them a the criteria for changing the
query definition that the form is based on - so far so good.

The final line of code behind the refresh is me.requery to refresh the
dataset.

The refresh does not seem to recognise the changed query definition and
reports the previous values.

However, if I manually open the control source query from the form
properties, I can preview the dataset and then on closing the control
source query the form reports the correct values.

What am i doing wrong here?

Many thanks,

Rob.


Are you changing the query. If so, you don't need to requery. Simply input
Me.Recordsource = <NewRecordSource>
Ex:
Dim s As String
s = "Select * From Emp Where LastName = 'Smith'"
Me.Recordsource = s

Usually my form will have a recordsource like
s = "Select * From Emp"
Me.Recordsource = s
so I have all records available in the table and then I may do some
things like
Dim s As String
s = "HireDate > #1/1/2005# And Dept = 'Accting' And Sex = 'M'"
Me.Filter = s
Me.FilterOn = True
and thus I filter the records based on criteria I have defined on the form.
Nov 13 '05 #2
Genius and obvious at the same time...

Many thanks.

Rob.

Nov 13 '05 #3

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

Similar topics

5
by: Scott | last post by:
I have created a form that has a few combo boxes on it. On the form I have ComboBoxA which selects data from a region, and ComboBoxB that selects individual locations within a selected region. I...
3
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
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...
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...
2
by: Axel | last post by:
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...
14
by: Kurt | last post by:
I have an unbound main form with an unbound subform. frmProjects fsubProjectList Using combo boxes, the user can select several search criteria on frmProjects and then click a command button....
4
by: midlothian | last post by:
Hello, I have conditional formatting set up on a subform based on a calculated value in the underlying query. For instance, if Sales are >$1000, the query displays "Yes," otherwise it displays...
7
by: SBC News Groups | last post by:
I have a form that the user enters some information on and then clicks a button to save the record. I do with the following line: DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,...
1
by: drag0n98 | last post by:
Hello, I've created a database that holds customer details, the main form has a subform that holds the actual account details, to add a new record the user clicks on a button that launches a new...
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
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?
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
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...
0
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...

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.