Yes. I've written a function I call odbcRowSource() that can be used as
the source for list and combo boxes. You put in odbcRowSource as the
RowSourceType and put the sql in RowSource. You must provide some sort of
global connection variable ("odbcConn") which can be through an odbcDirect
workspace. This makes things very fast (I was surprised myself!). If
this is new to you, read help on RowSource, RowSourceType, and using a
function as a rowsource. (You must know at least some Visual Basic).
I hate to hold you in suspense, but my current code has big bugs. I
should be finished with it tomorrow. Two things I'm working on 1. make it
so column heads works, 2. a neat feature that will make sure that for a
given SQL string, only one query is sent to the backend. This of course
would assume that you expect to always get the same results back. If not,
this will have to be disabled. It's useful for us so that's why I'm
putting it in. It can also be spread across your entire Access
application (ie, multiple forms with the same combo box only use one
recordset between them, and therefore possibly only one query throughout
the life of the session). (Note, it is easy to confine this to stay
within a form). One other thing is that you must remember to refresh
things often (this, I think, is very different from a requery.. I'll
experiment tomorrow). If you don't, (for example) two combo boxes that
should display the same thing might end up displaying something different.
-Cedar
ps. this is only for populating your combo box. Other fields and updating
are another story..
On Thu, 5 Apr 2001, Jean-Michel POURE wrote:
> Hello,
>
> Has anyone written an object to use passthrough queries in an Access
> 97/2000 form ?
>
> Need to be like :
> -> getvalues = load data into fields and combo ;
> -> setvalues = update record from fields and combo values.
>
> If anyone has been working on something, do not hesitate to share code ...
> I will post mine when ready.
>
> Greetings from Jean-Michel POURE, Paris