Solved

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

Posted on 2007-12-06
6
585 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

632 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