AddIn: who am I? 
Author Message
 AddIn: who am I?

Hi everyone,

I need to have an Access-AddIn which is able to read/write data into its own tables/queries by
programming. That means, I have to find out who I am:

sub WriteIntoMe()
        dim DB as database
        dim RS as recordset

        set db=Opendatabase(...whoAmI?...,false)        'here's my problem!
        set RS=db.openrecordset("ExistingQueryInAddin",dbopendynaset)

        rs.addnew
        rs.fields("MyField").value="This is new"
        rs.update
end sub

Obviously I can't use "CurrentDB()" or "DBEngine(0)(0)" as they represent the visible database and NOT
the addin database.

I know how to read the
"HKEY_LOCAL_MACHINE\Software\Microsoft\Office\8.0\Access\Menu-AddIns\MyOwnAddIn\Library" value with the
path of my Addin database. But that's a lot of undesired (API-)code and I can't believe there's no
"ThisDB()"-construction like WinWord's "ThisDocument"?! I tried several "...parent" ideas but with no
success either.

And BTW, how can I import tables/queries/forms from an Addin database into the currentdb by programming?

Thanks in advance, Lorenz



Mon, 20 May 2002 03:00:00 GMT  
 AddIn: who am I?



Quote:
> Hi everyone,

> I need to have an Access-AddIn which is able to read/write data into its

own tables/queries by

Quote:
> programming. That means, I have to find out who I am:

> sub WriteIntoMe()
> dim DB as database
> dim RS as recordset

> set db=Opendatabase(...whoAmI?...,false) 'here's my problem!
> set RS=db.openrecordset("ExistingQueryInAddin",dbopendynaset)

  Just use CodeDB to refer to the Addin mdb.  CurrentDB will give you a
reference to the mdb open in Access, as you already know.

 -- Dev



Mon, 20 May 2002 03:00:00 GMT  
 AddIn: who am I?
Hi Dev,

why can't they just give them the same names?? Thanks!

Lorenz

Quote:
>   Just use CodeDB to refer to the Addin mdb.  CurrentDB will give you a
> reference to the mdb open in Access, as you already know.

>  -- Dev



Tue, 21 May 2002 03:00:00 GMT  
 AddIn: who am I?
Well, I wouldn't be able to tell you why, but as a guess, maybe because each
has it's own purpose.  CodeDB is the only direct way of distinguishing
between multiple dbs "open" that you can reference, while CurrentDB always
refers to the db that is "visually" open in the UI.

  -- Dev



: Hi Dev,
:
: why can't they just give them the same names?? Thanks!
:
: Lorenz
:
: >   Just use CodeDB to refer to the Addin mdb.  CurrentDB will give you a
: > reference to the mdb open in Access, as you already know.
: >
: >  -- Dev



Sat, 25 May 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Custom Addin calling another custom Addin

2. How do I get a VB5 AddIn DLL in the Addin Manager

3. Help: Need advise on turning VB Addin into Excel Addin

4. I am trying to update a record, i am not using data control

5. I am learning VB.NET and am wondering....

6. I am trying to update a record, i am not using data control

7. When is 5:00 AM not 5:00 AM? When it's 5:00 AM.

8. Problems to create a classmodule from an own addin

9. unregistering COM AddIn

10. Transfer Date from XLS addin to Access

11. Addin Menu Like Behaviour on Other Submenus

12. Convert custom Addin from Access 97 to 2000

 

 
Powered by phpBB® Forum Software