How do I obtain a forms list from external database

A

Alp

Hi Experts,

What would be the best approach in getting a list of forms from an external
database via VBA?

So far the only way I could was to create a new table in the running
application, appending the needed field data from MSysObjects of the ext db
and by a QueryDef displaying the result. Actually I do not want to store
this data in the current application but rather use it as a source for a
combobox control on a form.

Possible? Thanks in advance.

Alp
 
D

Dirk Goldgar

Alp said:
Hi Experts,

What would be the best approach in getting a list of forms from an
external database via VBA?

So far the only way I could was to create a new table in the running
application, appending the needed field data from MSysObjects of the
ext db and by a QueryDef displaying the result. Actually I do not
want to store this data in the current application but rather use it
as a source for a combobox control on a form.

Possible? Thanks in advance.

Alp

Try this:

SELECT MSysObjects.Name AS FormName
FROM [C:\Path To\OtherDB.mdb].MSysObjects
WHERE MSysObjects.Type=-32768
ORDER BY MSysObjects.Name;

Replace "C:\Path To\OtherDB.mdb" with the fully qualified path to the
external database.
 
A

Alp

Thanks Dirk,

It should work if I could only get the SQL to obtain the fully qualified
path from an open form's textbox. As it is now, I will need to alter the fqp
each time. I'm trying to find a way to incorporate that now.

Alp

Dirk Goldgar said:
Alp said:
Hi Experts,

What would be the best approach in getting a list of forms from an
external database via VBA?

So far the only way I could was to create a new table in the running
application, appending the needed field data from MSysObjects of the
ext db and by a QueryDef displaying the result. Actually I do not
want to store this data in the current application but rather use it
as a source for a combobox control on a form.

Possible? Thanks in advance.

Alp

Try this:

SELECT MSysObjects.Name AS FormName
FROM [C:\Path To\OtherDB.mdb].MSysObjects
WHERE MSysObjects.Type=-32768
ORDER BY MSysObjects.Name;

Replace "C:\Path To\OtherDB.mdb" with the fully qualified path to the
external database.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
A

Alp

Hi Dirk,

Please disregard my earlier response. I got it working via code.

Thanks for your guidance once again.

Sincerely,

Alp

Dirk Goldgar said:
Alp said:
Hi Experts,

What would be the best approach in getting a list of forms from an
external database via VBA?

So far the only way I could was to create a new table in the running
application, appending the needed field data from MSysObjects of the
ext db and by a QueryDef displaying the result. Actually I do not
want to store this data in the current application but rather use it
as a source for a combobox control on a form.

Possible? Thanks in advance.

Alp

Try this:

SELECT MSysObjects.Name AS FormName
FROM [C:\Path To\OtherDB.mdb].MSysObjects
WHERE MSysObjects.Type=-32768
ORDER BY MSysObjects.Name;

Replace "C:\Path To\OtherDB.mdb" with the fully qualified path to the
external database.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

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