Hi,
From the query designer, switch in SQL view. Select the whole code, from
the keyboard, make Ctrl_C. Go in you VBA module, where you want to paste the
code, do it with Ctrl_V. It is possible that the code will be in red,
because it is not a valid VBA statement, it is a SQL statement. You have to
use delimiter, generally ", around it to make it as text, and use it in an
appropriate context, like
CurrentDb.Execute " UPDATE ... "
or like
Set rst=CurrentDb.OpenRecoreset("SELECT ... ")
Hoping it may help,
Vanderghast, Access MVP