I need to extract a selected record from a table (not source in form) and extract a field value which I want to set equal to a public variable.
any help?
Thanks Jim
Yes, I can do a Docmd.runsql to get the data, but I then need to put the data into a public variable. If I run a Docmd.runsql "select" how do I put the result into a variable?
Jim
SOrry for appearing stupid, but this is vexing...
Dim db as database, rst as Recordset
Set db=currentdb()
Set rst=db.OpenRecordset("Your Query",dbOpendynaset)
YourPublicVariable=rst!YourFieldOfInterest
The above assumes you query is setup to return the single record of interest. If not, you'll have to use the FindFirst method to set the record pointer to your record of interest.
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.