G
Guest
I created a customized SQL string that uses input from a form. Now, since it
is customized based on the given information in the form, I cannot create a
pre-designed query. So, to get around this, I began to use:
Dim SQLString As String
SQLString = "SELECT * FROM <table based on form input>"
DoCmd.RunSQL SQLString
Problem: RunSQL does not process the SELECT statement. Apparently it only
accepts action queries (queries that make modifactions to tables).
So, I tried:
Dim cmd As Command
cmd.CommandText = SQL String
cmd.CommandType = adCmdText
cmd.Execute
Problem: Doesn't work because I believe I have to set up the
cmd.ActiveConnection, which I do not know how to set up to tell it to connect
to the current DB.
Is there anything I can do to process this simple SELECT statement without
creating a pre-designed Query?
Thanks, Shane
is customized based on the given information in the form, I cannot create a
pre-designed query. So, to get around this, I began to use:
Dim SQLString As String
SQLString = "SELECT * FROM <table based on form input>"
DoCmd.RunSQL SQLString
Problem: RunSQL does not process the SELECT statement. Apparently it only
accepts action queries (queries that make modifactions to tables).
So, I tried:
Dim cmd As Command
cmd.CommandText = SQL String
cmd.CommandType = adCmdText
cmd.Execute
Problem: Doesn't work because I believe I have to set up the
cmd.ActiveConnection, which I do not know how to set up to tell it to connect
to the current DB.
Is there anything I can do to process this simple SELECT statement without
creating a pre-designed Query?
Thanks, Shane