I have a form that is based on a query, which includes some formulas. How would I programmatically determine if the control source of a control is a formula in the query as opposed to a field in the query?
you could test the sql string of the query for the string 'As fieldname'. If it's there it is a formula otherwise it's a field from the table.
Function testname(fname As String)
testname = "Table"
Dim strsql
Dim qdf As DAO.QueryDef
Set qdf = CurrentDb.querydefs("queryname")
strsql = qdf.SQL
If InStr(1, strsql, "As " & Trim(fname)) > 0 Then testname = "Calc"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.