Thursday, March 29, 2012

Create a view in VBA

Hi,

Is it possible to create some SQL in VBA, 'run it' then view as a datasheet
the results?

I'm trying to throw together a fairly large search form, and VBA seems the
best way to parse the parameters.

Cheers,
Chris"Not Me" <Not.Me@.faker.fake.fa.kee> wrote in message
news:c6rag7$kt$1@.ucsnew1.ncl.ac.uk...
> Hi,
> Is it possible to create some SQL in VBA, 'run it' then view as a
datasheet
> the results?
> I'm trying to throw together a fairly large search form, and VBA seems the
> best way to parse the parameters.
> Cheers,
> Chris

Yes - you could use the ADO COM objects, then return results to your client
and format/present them there. If you need a more precise answer, then it
would help to have some more detail about what you're trying to do and what
tools you're using (eg. Access, Excel etc.).

Simon|||"Simon Hayes" <sql@.hayes.ch> wrote in message
news:40913ac0$1_1@.news.bluewin.ch...
> "Not Me" <Not.Me@.faker.fake.fa.kee> wrote in message
> news:c6rag7$kt$1@.ucsnew1.ncl.ac.uk...
> > Hi,
> > Is it possible to create some SQL in VBA, 'run it' then view as a
> datasheet
> > the results?
> > I'm trying to throw together a fairly large search form, and VBA seems
the
> > best way to parse the parameters.
> Yes - you could use the ADO COM objects, then return results to your
client
> and format/present them there. If you need a more precise answer, then it
> would help to have some more detail about what you're trying to do and
what
> tools you're using (eg. Access, Excel etc.).

Thanks for the reply.
In the past, I have been able to pre-write a query in Access, (i.e. have it
saved in the queries list) and use docmd.openquery in VBA to have it
displayed on screen.
I have also been able to create queries 'on the fly' in VBA, and be able to
iterate through them/work on them in the same program.
What I'd like to do is sort of combine the above, so create a query in VBA
and have it displayed in a datasheet view. So the user in an ADE would
select from a few comboboxes, press go and up would pop the resulting query.

Cheers,
Chrissql

No comments:

Post a Comment