Open queries in code.

  • Thread starter Thread starter Guy Hocking
  • Start date Start date
G

Guy Hocking

Hi there,

I realise this is probs a stupid question, but how do you open a query from
code as a macro would?

I need to run some error checking of a form before a command button call a
query, i thought that the most effective/only way of doing this was in
coding. but i can to the error checking but i cant open the blasted query
afterwards!!!

I tried OpenQuery to no avail.

If anyone could please give full details of how to open a query from code,
that would be great

Thanks in advance

--
GH

www.bradflack.com

Please remove ANTI and SPAM from my
email address before sending me an email.
 
OK DoCmd, got it, no probs.....

However, a different question -

How do i get a report to display data as a column, rather than seperate
tables for seperate records.
I want the data to appear like a table/query would.

Thanks

Guy
 
Try using "Tabular View" while creating your form at the layout section of
Form Wizard.

Alp
 
From a Dwayne Hookum post
Place all you controls on the left third of the page and
select File|Page
Setup|Columns...

Jim
 
Hi there,

I realise this is probs a stupid question, but how do you open a query from
code as a macro would?

I need to run some error checking of a form before a command button call a
query, i thought that the most effective/only way of doing this was in
coding. but i can to the error checking but i cant open the blasted query
afterwards!!!

I tried OpenQuery to no avail.

If anyone could please give full details of how to open a query from code,
that would be great

Thanks in advance

It's very rarely necessary to open a Query in datasheet view. What
error checking are you doing? Why would opening a query datasheet help
in this effort?

DoCmd.OpenQuerydef("queryname")

will do it - but I wonder if there might not be some other way of
using the query to better advantage!
 
Back
Top