B
bgcpen
Is it possible to reference a calculated field in a recordset? Here is the
code i have.
I have a query that searches the email body field and gets a string from
that field. So the only true field in the query is [body]. However, the text
i would like to use in the code is a calculated field. Is there any way to
set a variable to equal a calculated query field? (ie. want to set userName
to equal calculated field string.)
Function RecordSetQuery()
Const strqryName = "servicemom_alerts"
Dim userAlias As String
Dim userName As String
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb() ' Open pointer to current database
Set rs = db.OpenRecordset(strqryName) ' Open recordset on saved query
Do While Not rs.EOF
'Debug.Print (rs![Expr3])
userName = (rs![Expr3])
Call sbSendMessage(userAlias, userName)
'Debug.Print userAlias
rs.MoveNext
Loop
rs.Close
db.Close
End Function
code i have.
I have a query that searches the email body field and gets a string from
that field. So the only true field in the query is [body]. However, the text
i would like to use in the code is a calculated field. Is there any way to
set a variable to equal a calculated query field? (ie. want to set userName
to equal calculated field string.)
Function RecordSetQuery()
Const strqryName = "servicemom_alerts"
Dim userAlias As String
Dim userName As String
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb() ' Open pointer to current database
Set rs = db.OpenRecordset(strqryName) ' Open recordset on saved query
Do While Not rs.EOF
'Debug.Print (rs![Expr3])
userName = (rs![Expr3])
Call sbSendMessage(userAlias, userName)
'Debug.Print userAlias
rs.MoveNext
Loop
rs.Close
db.Close
End Function