![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I am working on a user interface for a lab database in Access 2007. The 9 tables with the actual data are in a back-end database and the forms are completely separate. My forms reference local ADO recordsets. I want to create a query wizard--a form that allows the user to set criteria for a query, then run it. I've succeeded in doing that, to some extent. My VBA code checks information on the form and builds a SQL statement, then uses the SQL statement to open a new recordset. The "results" recordset is then displayed in a form in table format. The problem is that it has already taken tons of code to make fairly simple queries work, and I want my "wizard" to be able to deal with queries of arbitrary complexity. I feel like I'm reinventing the wheel, since Access can already do query wizards and a graphical interface for query design. Is there some way that I can harness that capability for use in my interface with local recordsets? Or should I just keep slogging away at what I've started? Let me know if any more details would be helpful--I stated my question rather broadly. Thanks, Shevaun |
#3
| |||
| |||
|
|
By local ADO recordsets I'm guessing you are talking about those saved in adtg or xml format. |
|
A continuous form in an ADP (probably mdb too) can have its recordsource set to an ADO recordset. So why not create the form, open the recordset and instead of using SQL to filter the records use a Filter statement?, and then set the continuous form's recordset to that recordset? |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
On Feb 25, 12:21 pm, lyle <lyle.fairfi... (AT) gmail (DOT) com> wrote: By local ADO recordsets I'm guessing you are talking about those saved in adtg or xml format. As far as I know (which isn't very far), the recordsets are never "saved"--they exist only as objects in my VBA code. I establish a connection to the databse with the data tables, create a recordset based on one or more tables, and then close the connection. The data tables are updated in batches from the local recordsets. When I close the application, the recordsets disappear--they're not saved. They have to be recreated next time the application is opened. A continuous form in an ADP (probably mdb too) can have its recordsource set to an ADO recordset. So why not create the form, open the recordset and instead of using SQL to filter the records use a Filter statement?, and then set the continuous form's recordset to that recordset? I do set the recordsource of the form that contains the query results to the query recordset. As far as using Filter statements instead of SQL, I don't think it would make the problem any more straightforward. Generating Filter statements would take just as much code as generating SQL statements. Furthermore, I need the SQL statement so I can specify which tables and fields the recordset will be based on, as well as the relationships between the tables. The problem isn't with SQL itself; the problem is generating the SQL based on the users choices in a bunch of combo boxes and check boxes. Does that make sense? -Shevaun |
![]() |
| Thread Tools | |
| Display Modes | |
| |