Can the output of docmd.runsql strsql be stored in a string?
I have a table with name and city. I want to display the city based on the name.
I can point to data source or use Dlookup to get that, but I want to try using Docmd.runsql to store it in a string (str2)and display/use it later?
Dim strsql As String
Dim str2 As String
strsql = "select city from table1 where name= '" & txtName.Value & "';"
DoCmd.RunSQL strsql
Is it possible to do that and how should the syntax be?
I have a table with name and city. I want to display the city based on the name.
I can point to data source or use Dlookup to get that, but I want to try using Docmd.runsql to store it in a string (str2)and display/use it later?
Dim strsql As String
Dim str2 As String
strsql = "select city from table1 where name= '" & txtName.Value & "';"
DoCmd.RunSQL strsql
Is it possible to do that and how should the syntax be?