Executing a hidden query

P

Phil Hibbs

I've got a form, and when I click a button it opens a query, but I don't want that query to be visible to the user. I just want the VBA to exectue the query and fetch some values into unbound controls on the form. Any suggestions how I can do that?

Phil Hibbs.
 
J

John W. Vinson

I've got a form, and when I click a button it opens a query, but I don't want that query to be visible to the user. I just want the VBA to exectue the query and fetch some values into unbound controls on the form. Any suggestions how I can do that?

Phil Hibbs.

Don't open the query at all. Instead use =DLookUp("[fieldname]",
"[queryname]", "optional criteria") as the Control Source of the textbox. You
can of course just use DLookUp directly on the table using the same criteria
as you use in the query, and not bother creating the query at all.

Note that this forum is no longer supported by Microsoft; Usenet newsgroups
are like "the living dead". But there are only a couple of us old timers who
still check the group at all. See my .sig for better, more active forums for
support.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:

http://answers.microsoft.com/en-us/office/forum/access?tab=question&status=all
http://social.msdn.microsoft.com/Forums/office/en-US/home?forum=accessdev
and see also http://www.utteraccess.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top