select query in access using vb

R

RoyShnider

i wana use a select query in access using vb "my own query",i want the method
or the way tha send this query licke docmd
i tried docmd.run query bt it doesnt work in it only worked on update
 
R

Reggie

Roy, Try this:
DoCmd.OpenQuery "yourQuery", acViewNormal, acEdit

If it's an action query and you don't want to see the warning messages that pop up to warnings of,
but make sure your turn them back on like so

DoCmd.SetWarnings False
DoCmd.OpenQuery "yourQuery", acViewNormal, acEdit
DoCmd.SetWarnings True

Hope this helps!
 
N

Nick Coe \(UK\)

DoCmd.RunSQL only works for action and data definition
queries. It won't work for Select queries.

You can do as Reggie suggests and use DoCmd.OpenQuery
"YourQueryName", view, datamode to run an existing query.

Or use the .Execute method in DAO or ADO. The Help on these
is there if somewhat terse for the ADO.
 

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