[AccessD] weird query def

Mark H Lists at theopg.com
Wed Jul 2 04:34:20 CDT 2003


I think John is creating an Addin - I did it as simple mdb's just to
show it could be done. I tried using DAO and even with the reference to
db1 it failed as described by John. I'm not sure, I don't use addins
generally as most of my generic stuffs in a DLL. I presume registering
an addin creates a reference too??? 

Cheers

Mark

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: 02 July 2003 10:23
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] weird query def


Hi Mark

Thanks Mark!

But this was my suspicion:

> 'References set to .. db1.mdb (where the query and function are)

That's the trick.
If you do so, I guess DAO will work fine as well.

/gustav


> Sorry, I should have done it last night. I'd had a few beers and just 
> zipped up the mdb's and sent them to John (wasn't sure about sending 
> attachments to the list). Here's the code then.... It's simple and a 
> bit rough, just to show it could be done.

> In db1.mdb there is a simple function that multiplies one value by 
> another. There is also a query which uses the function as column "X" 
> (could be anything).

> In db2.mdb...

> Sub mTest()
> 'References set to ADO 2.1 and to db1.mdb (where the query and 
> function
> are)
>     Dim rs As ADODB.Recordset
>     Dim strCon As String
>     Dim fld As ADODB.Field
    
>     strCon = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data 
> Source=E:\Data\db1.mdb"

>     Set rs = New ADODB.Recordset
    
>     rs.Open "SELECT * FROM Query1", strCon
>         'Note: you should set the where clause to return
>         'no records - make it quicker, data not needed anyway
>     For Each fld In rs.Fields
>         Debug.Print fld.Name
>     Next
    
>     Set rs = Nothing
>     strCon = ""
    
> End Sub

> Cheers

> Mark

> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav 
> Brock
> Sent: 02 July 2003 09:11
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] weird query def


> Hi Mark

> OK. Thanks but I don't have a specific need right now. It was out of 
> curiosity - it would be nice to have look. Couldn't you just post the 
> relevant code here - also for the benefice of others following this 
> thread?

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list