soukupmd
asked on
Using a variable in an SQL Pass-Through query in MS access.
I am trying to run a pass-through query in access with a variable that a user enters in a form. I can't seem to get this to work. Can somebody please help? The variable should be where the 121212 is in the code snippet.
Thanks!
Thanks!
FROM doc..eco_summary es
INNER JOIN
((((mart..DM_Map dmm LEFT JOIN mart..DM_PI dpi ON dmm.Acct_ID = dpi.Acct_ID)
INNER JOIN mart..DM_Note dmn ON dmm.Acct_ID = dmn.Acct_ID)
INNER JOIN mart..DM_ACCT dma ON dmn.Acct_ID = dma.Acct_ID)
LEFT JOIN mart..DM_RE dmr ON dmn.Acct_ID = dmr.Acct_ID) ON es.L_loannum = dmm.Acct_ID
INNER JOIN weis..eco_loan_origination elo ON es.L_num = elo.num
where es.L_num = 121212
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What about it isn't working? Unexpected return? Error message?
Do you have you variable inside the quotes for the string? If so you need to take the variable outside of the string
"Where es.L_num =" & VariableName
"Where es.L_num =" & VariableName
FROM doc..eco_summary es
INNER JOIN
mart..DM_Map dmm LEFT JOIN mart..DM_PI dpi ON dmm.Acct_ID = dpi.Acct_ID
INNER JOIN mart..DM_Note dmn ON dmm.Acct_ID = dmn.Acct_ID
INNER JOIN mart..DM_ACCT dma ON dmn.Acct_ID = dma.Acct_ID
LEFT JOIN mart..DM_RE dmr ON dmn.Acct_ID = dmr.Acct_ID ON es.L_loannum = dmm.Acct_ID
INNER JOIN weis..eco_loan_origination
where es.L_num = 121212