I know that in VBA, you can use the With statement to reduce the amount of code involved when you are using multiple parts of a whole. Is this possible with SQL strings?
For example, could you do something like this:
I may have an ( or " in the wrong place, or too many or too few, but it's just for an example. I was just wanting to know if anyone knew whether this is possible or not.
So, is it possibe?
Stephen![[infinity] [infinity] [infinity]](/data/assets/smilies/infinity.gif)
"Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me." John 14:6 KJV
For example, could you do something like this:
Code:
Dim myquery As QueryDef
Dim strQueryName as Sring
strQueryName = cmbCombo1 & "_" & cmbCombo2
With tblMyTable
Set myquery = CurrentDb.CreateQueryDef([strQueryName], _
"SELECT .Year, .Month, .Name, .Status, .Manager " & _
"FROM tblMyTable " &_
"WHERE (((.[Year]) = [Forms]![frmMyForm]![cmbYear]));")
End With
I may have an ( or " in the wrong place, or too many or too few, but it's just for an example. I was just wanting to know if anyone knew whether this is possible or not.
So, is it possibe?
Stephen
![[infinity] [infinity] [infinity]](/data/assets/smilies/infinity.gif)
"Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me." John 14:6 KJV