Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is control source a formula (Access 2000)

Status
Not open for further replies.

MackC

Programmer
Nov 8, 2001
23
0
0
US
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"

End Function
 
Thanks, that should work unless someone has a better suggestion.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top