Solved

Query on load cmd

Posted on 2009-04-13
9
195 Views
Last Modified: 2013-11-28
Can I have the filter by form button run as soon as query opens?
0
Comment
Question by:-Gil
  • 4
  • 3
  • 2
9 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 480 total points
ID: 24131095
Try this in the load or open event:

docmd.RunCommand acCmdFilterByForm
0
 

Author Comment

by:-Gil
ID: 24131111
Where do I put this in a query I dont see a load or open event.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24131570
One of the reasons why queries are used, is for filtering.

So you could also add whatever you are trying to filter for as the Criteria.

(Or am I missing something)?

JeffCoachman
0
 

Author Comment

by:-Gil
ID: 24131928
I would like the query to open and appear like the screen shot below.
 It will not be used in a form or report.

On load I would like it to open with the FILTER BY FORM button pressed.

Like mbizup posted above with the docmd.RunCommand acCmdFilterByForm.
I see how that works for a form or report but I would like the query to start like that.

-gil


QuerypicEE.bmp
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 20 total points
ID: 24132285
(No Points wanted)


Open the query from a button on a form.

The code on the button will be something like this:

  DoCmd.OpenQuery "YourQuery"
  DoCmd.RunCommand acCmdFilterByForm

Again, no points wanted.

;-)

Jeff
0
 

Author Comment

by:-Gil
ID: 24132406
Curious.
Why wouldn't you want the points?
-gil

0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24132907
Gil,

"Why wouldn't you want the points?"

1. Because the solution is mbizup's, not mine.
2. I don't really care about the points.
4. You have given me enough points!  ;-)  LOL!
3. I did this just to help out

So give the full points to mbizup

;-)

Jeff
0
 
LVL 61

Expert Comment

by:mbizup
ID: 24133238
Jeff,

Thanks.

-Gil
Sorry for being absent on this one.  I've been swamped today.  When I posted, I had misread "as soon as query opens" as  "as soon as Form opens".  

I'd be happy with any point allocation you decide on.  I have a lot of points and still can't trade them in for a steak dinner.  :)
0
 

Author Comment

by:-Gil
ID: 24137191
4. You have given me enough points!  ;-)  LOL!

So so true lol

Still gave you 20 to highlight the post
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

910 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now