I am new to MS Access and I was wondering if their is a way to run a Query as a total query and put the result on a form that is not bound to a datasource. I would asume you use ADO but i am not sure how to do it.
Since you mention ADO I assume you are on Access2000 or AccessXP, so the minimum code is:
Dim cn As ADO.Connection
Dim Rs as ADO.REcordset
Set cn = CurrentProject.Connection
Set Rs = NEW ADO.Connection
Rs.Open "SELECT ...etc your SQL here",cn
If Rs.RecordCount > 0 Then
txtControl = RS!ColumnName
End if
Rs.Close
Set Rs = Nothing
Set cn = Nothing
You need to use your own control/columnnames of course and theer are other parameters / seetings which you may wish to investigate (eg CursorLocation, and further parameters in the Rs.Open method
Regards
Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now -
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.