How to prompt user for parm value from module

I've found stuff all over the Internet that hits around my question, but nothing that directly addresses the issue.  I have a module that I'm using to output a text file.  Part of the data that is output is going to come from a parameter query I've built.  My goal is to be able to simply run the module and be prompted for the parameter.  Most of what I've read deals with getting the parameter value from a form, but in this case, a form is neither necessary nor desired.  The module and db will only ever be used/accessed by myself and my boss.  I've fiddled with the code (both DAO and ADO methods) to open the query and pass it the parameter value, but I keep running into errors.  The primary one being "Object variable or With Block variable not set."  Below is the current state of my code.

    Dim cmd As New ADODB.Command
    Dim rst As New ADODB.Recordset
    Dim param As ADODB.Parameter
    'Dim qry As DAO.QueryDef
   ' Dim db As DAO.Database
    'Dim parm As DAO.Parameter
    'Dim rst As DAO.Recordset

    Set cmd.ActiveConnection = CurrentProject.Connection
    cmd.CommandText = "GET_TMFR_DATA"      'name of param query
    For Each param In cmd.Parameters
        param.Value = Eval(param.Name)
    Next param
    Set rst = cmd.Execute(cmd.CommandText, param)

    'Set qry = db.QueryDefs("GET_TMFR_DATA")
    'qry.Parameters(0) = "FS06"
    'Set rst = qry.OpenRecordset

The lines that are commented out are the DAO method which yields the error "Object variable or With Block variable not set.
The ADO method yields the error "Invalid SQL statement; expected DELETE, INSERT, PROCEDURE, SELECT, or UPDATE statement"
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

use the Inputbox

YourParm =inputbox("what is the value you want to enter")

then YourParm have the value you want , and you can use it in your code.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
xhatAuthor Commented:
Of course! How obvious.  Thanks for showing me the forest. The trees were in the way.
it must have been foggy too :o)

you are welcome,
thanks for the points and the grade

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.