I am trying to pass a vba string variable to an IN clause of a SQL statement in the query builder view.
the string is created by the following function:
Public Function GetBackEnd()
If Len(GetBackEnd) = 0 Then GetBackEnd = BackEnd
End Function
backend itself is derived from a dropdown box in userform, there are two entries in a table with two different addresses, one each for the live and developement DB's. The dropdown box sets the "environment" variable upon selection.
Property Get BackEnd() As String
Select Case Environment
Case Is = "Development"
BackEnd = DLookup("VariableValue", "Globals", "Variable= 'TestEnvironment'")
Case Else
BackEnd = DLookup("VariableValue", "Globals", "Variable= 'Backend'")
End Select
End Property
I have tried a couple of variations on the following but get an error each time.
SELECT *
FROM TableName IN 'GetBackEnd()';
I imagine its something simple but after staring at this for so long Ijust can't see it.
thank you.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…