Query Form field from another database

leodone

New member
Local time
Yesterday, 18:44
Joined
Dec 28, 2010
Messages
4
Hello everyone,

I have two database: A and B.

Database "A" has all the forms and database "B" has some query and tables that are linked to "A".

My question is: I have a query that referance a field from a form in database "A". How do I write that statement in my query?

For example;

Query in Database "B":

SELECT tblPreferred.Policy,
tblPreferred.SharesPurchased,
tblPreferred.PurchaseDate,
tblPreferred.Amount,
tblPreferred.SharePrice,
tblTransactions.TransactionDescription AS [ Transaction ],
tblPreferred.ID
FROM tblPreferred
INNERJOIN tblTransactions
ON tblPreferred.TransactionType = tblTransactions.TransactionID
WHERE(((tblPreferred.PurchaseDate)Between [Forms]![frmReports]![txtStatementFrom ] And [Forms]![frmReports]![txtStatementTo]));

This field is coming from database "A" but how do I referance database "A"?
[Forms]![frmReports]![txtStatementTo]

Please Help.

Thanks

Leo
 
You can only do this if your code actually opens up the other database and has control over it. You cannot just get it from the database if it was opened by a user or yourself. In other words, you would have to use global objects which you would use in your database "B" which could then reference something in "A."

So you would open Database B and then the code in Database B could open an instance of Database A and then it can reference objects there. Is that how you could use it? What is Database A and why are you trying to get a value from its form? How is Database A used? And B for that matter?
 
Database "A" is the main database that has all the contact info.
Database "B" will be use for setting up a schedule printing job using windows scheduler.

Or
do you know another way of scheduling printing jobs?

Thanks,

Leo
 
Database "A" is the main database that has all the contact info.
Database "B" will be use for setting up a schedule printing job using windows scheduler.

Or
do you know another way of scheduling printing jobs?

Thanks,

Leo

So, you forgot to say what you were trying to get from database A to use in B. Why a form from database A? You could link Database A to B and then open the appropriate table in B to get what you need, potentially (but not sure as you haven't given much to go on).
 

Users who are viewing this thread

Back
Top Bottom