How do I create a new query in VBA and save it to an Access Db?

G

geoaerocfi

I am trying to replace an exitsting query in a MS-Access 2007 database with
one that I've created in VBA code. I already know how to delete or rename
existing queries, but can't find any functions that create a new query.
 
C

Chris O'C via AccessMonster.com

Dim qdf As QueryDef
Dim db As Database

Set db = CurrentDb
Set qdf = db.CreateQueryDef("qryname", _
"select firstname, lastname from employees " _
& "where lastname = 'jones'")

Chris
Microsoft MVP
 

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