Create a Query Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an application that is completely forms driven and I need to allow
users to create ad-hoc queries.

Does anyone have have suggestions or examples that I can reference?

Thanks in advance!

Dwight
 
Not sure if that what you mean, but you can try something like:
Create a query, and use the code to change the sql within this query, and
then run it.
' To change the SQL in the Query
Application.CurrentDb.QueryDefs("Queryname").SQL = "Select * From TableName"
Docmd.OpenQuery "Queryname"
 
I want to create a form which allows a user to create a query against the
tables in the database. The form needs to allow the user to select the
tables and fields, set criteria, sort, join, basically everything that can be
done within the MS Access query design window.

Thanks!
 
In that case using the example I gave you you can do something like

Application.CurrentDb.QueryDefs("Queryname").SQL = "Select " & Me.FieldsName
& " From " & Me.TableName & " Order By " & Me.SortFieldName
Docmd.OpenQuery "Queryname"

I hope that this example gives you an idea
 
Back
Top