Solved

Requery an Open Query from a Form, Use Isloaded to test if Query is already open

Posted on 2007-12-06
6
576 Views
Last Modified: 2008-02-01
I have a simple form with an unbound text box and a button that opens a calendar form.  The user selects the date from the pop-up calendar and it is entered into the textbox.  There is a query that uses the date from that unbound textbox as part of a calculated field that uses the iPmt Function.

I have a number of problems based on what I am trying to do with the above.

1)  When I change the date in the textbox using the pop-up calendar, it does not trigger the afterupdate event of the textbox.

2)  If the query isn't already open, I would like to open the query after the textbox has been updated. (Can't make isloaded with a query work)

3)  If the query is already open, I would like it to "requery" (I can't seem to make that happen based on the afterupdate event of the unbound textbox not triggering).  If that is not possible, I would like to test for the query already being open, close it, and open it again. (isloaded?)

I have plenty more issues, but this will get me started.  I have searched the EE for Requery info, and found some, but didn't answer my questions.  I really would like to know how to use IsLoaded with a query, and be able to requery an open query if possible.

Below was my attempt at isloaded, based on help files etc.  I am afraid I am just plain lost here.

If CurrentData.AllQueries(qryIntDue).IsLoaded = False Then
'DoCmd.OpenQuery "qryIntDue"
MsgBox "Hi"
Else
MsgBox "Bye"
End If

When I tried the above, it tested as false whether or not the query was open.

Thanks for any help that can be given.

Hubbs
0
Comment
Question by:Hubbsjp21
  • 3
  • 2
6 Comments
 
LVL 26

Accepted Solution

by:
jerryb30 earned 450 total points
ID: 20422844
Maybe:
If CurrentData.AllQueries("qryIntDue").IsLoaded = False Then
0
 
LVL 44

Expert Comment

by:GRayL
ID: 20422959
Jerry is telling you that you omitted the double quotes around the query name.
0
 
LVL 26

Expert Comment

by:jerryb30
ID: 20422990
Without telling you...:>)
0
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

Author Comment

by:Hubbsjp21
ID: 20423887
Okay . . . . the quotes solved that issue rather quickly.  It makes me feel a little better that I was at least on the right track . . .   THANKS!

What about requerying an open query (now that I can determine it is open) from that form that has the button.  Can that be done?

Any ideas on why the afterupdate tigger might not be working?
0
 
LVL 26

Assisted Solution

by:jerryb30
jerryb30 earned 450 total points
ID: 20424323
If we are talking about a datasheet view of a query,  do not think it can be done. I suspect requery does the same thing-Closes and opens the query which is the recordsource of a form. Otherwise, there would be a Refresh option in a query window. It just happens so fast, sometimes, you just do not notice. But I do not have access to resources at home to check.
0
 
LVL 44

Assisted Solution

by:GRayL
GRayL earned 50 total points
ID: 20424812
One cannot refresh or re-query a Query that is open.  It has to be closed and re-run.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question