View Full Version : query as recordset frustration for newbie


arkres
08-18-2007, 04:16 AM
Hi,

I'm new to vba. I am trying to get a clear example of creating a recordset with a query for the purpose of creating an email message using the details of that query. I know how to do this if I am looping through the records in that query, or if I use a make-table query, but I cannot find an understandable example of this if I want to open the query using a parameter entered by the user (such as an ID number). Can someone please point me in the right direction? It would be much appreciated. Thanks much.

Pat

lagbolt
08-18-2007, 07:34 AM
If hosted on a form that exposes a textbox named 'ID' ...
dim rst as dao.recordset
set rst = currentdb.openrecordset( _
"SELECT field FROM table WHERE ID = " & me.id)
debug.print !field

arkres
08-18-2007, 08:48 AM
Thank You !!!!