G
glnbnz
Hello,
I am trying to retrieve a value from a query. I have a form and when I
press a command button I would like the code to open a query, take the value
and place it into a variable then close the query.
Here is my code so far:
Dim sngValue As Single
DoCmd.OpenQuery "qryMyQuery", acViewNormal
sngValue = [Queries]![qryMyQuery]![SomeValue]
DoCmd.Close acQuery, "qryMyQuery", asSaveNo
Me.Text18.Value = sngValue
My problem lies in the 3rd line of the code and I can't seem to find the
correct syntax for obtaining "SomeValue" and storing it as "sngValue".
I know that I can do this a different way, but there is a method to my
madness where I am going to do a calculation from multiple queries.
Could someone help me with this?
Thank you.
I am trying to retrieve a value from a query. I have a form and when I
press a command button I would like the code to open a query, take the value
and place it into a variable then close the query.
Here is my code so far:
Dim sngValue As Single
DoCmd.OpenQuery "qryMyQuery", acViewNormal
sngValue = [Queries]![qryMyQuery]![SomeValue]
DoCmd.Close acQuery, "qryMyQuery", asSaveNo
Me.Text18.Value = sngValue
My problem lies in the 3rd line of the code and I can't seem to find the
correct syntax for obtaining "SomeValue" and storing it as "sngValue".
I know that I can do this a different way, but there is a method to my
madness where I am going to do a calculation from multiple queries.
Could someone help me with this?
Thank you.