Automation: Open DB & Form, Run Function/Select Listbox

  • Thread starter Thread starter wrldruler
  • Start date Start date
W

wrldruler

A user is in Database A. They open project #52. They then hit a
button. I need it to:

(1) Open a second Database B -- I got this working with:
.OpenCurrentDatabase constrDBName

(2) Open a specifc form in DB B -- I got this working with:
appAccess.DoCmd.OpenForm "frm_test"

(3) Select specific record #52 on "frm_test". The problem is that a
simple Filter *won't* work because I need to call a function so that a
half dozen variables can be set, do some null checks, etc

I need it to run this function: Open_Project(52) and pass the 52
Project_ID variable. I can use .DoCmd.RunMacro, to run a RunCode
command, to call my function. But I can't figure out how to pass 52 to
a Macro.

Or I need it to open the form, select #52 in a Listbox called
Me.List_Projects, then run Open_Project(). The function will go to the
Listbox to know which Project ID to select. But I can't figure out how
to select #52 in a Listbox via Automation.

Summary: How do I use automation to either call a function in another
database and pass it a variable, or how do I pass a variable via
DoCmd.RunMacro, or how do I use automation to select a specific record
in a Listbox?

Thanks,

Chris
 
This may be helpful to you as I'm sure there are a few different ways of
doing what your asking.
What if you had a table where you populated the "variable" 52, then when
opening the form, query or report, the criteria is based upon that value.
This table would likely be a table in the first database, in which the second
database has a link to. Something to consider.

SteveD
 

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

Back
Top