Is it possible to select a value from a foreign table using vba? The code is going to be executed automatically every month.
I can get the variable I want using a SQL statement, it is possible to pass a SQL value into a variable? For Instance the following SQL selects the value that I need, I know this doesn't work but hopefully you can understand what I mean.
Code:
EmailAddress = "SELECT tblGuardians_RepPayee.Email FROM tblGuardians_RepPayee INNER JOIN tblClients ON tblGuardians_RepPayee.GuardianPayeeID = tblClients.RepPayee WHERE tblClients.ClientID=" & rst![ClientID] & ";"
I'm running reports based off tblPettyCashTransactions and need to the RepPayee Email address to email the report. My table struture is set up like this
tblGuardians_RepPayee
GuardianID
...
Email
tblClients:
GuardianId
...
tblPettyCashTransactions
ClientId
...