I need a way to change the source(table) within a Access query automatically. But this should be done by the user so there must be a way that the user can select which table should get selected via a Form.
Could you give us a little more information? If you've got a form that will look the same for different tables, it sounds like your data isn't normalized. Basically, there's not many good reasons for having tables laid out the same as each other--they should all be in one table.
techsupportgirl@home.com
Hello
Thanks for your help Dreamboat. There is a need for me to make several tables because server performance is to slow in my company. So that means I have a few different tables with the same field names and therefore I need a way that all queries and forms will change the table source so that I don?t have to create for every table another query/form.
Let's say you've got an option group with three choices.
Command Some Button On_Click()
Dim dbs
Dim qdef
Dim TableName as string
Dim strSQL
Set dbs = currentdb()
Set qdef = dbs.QureyDefs("YourQuery"
Select case optgrp1
Case 0
Table Name = "Table1"
Case 1
Table Name = "Table2"
Case 3
Table Name = "Table2"
strSql = "Select * from " & tableName
qdf.SQL = strSQL
End Sub Tyrone Lumley
augerinn@gte.net
Thanks Databaseguy
You have solved one thing of the problem. The other problem is now the tables will change but also the criteria that I put in is lost and that´s a problem. So this means I have in all different tables the same fields with the same criteria so the fields that have been filtered with a criteria should be changed.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.