Re: Query base on a changing table
- From: "SilvrT" <rlyerex@xxxxxxxxx>
- Date: 30 Sep 2005 12:24:06 -0700
I created 2 table with identical fields.
The following code will prompt for which table, create a specific query
based on the table entered, and open the query displaying specific
records.
You may need to set a Reference to the Microsoft DAO 3.6 Object Library
Sub ShowVariableTables()
Dim strTableName As String
Dim strsql As String
Dim dbsCurrent As database
Dim qdfMyQuery As querydef
Set dbsCurrent = CurrentDb
strTableName = InputBox("Which Table?")
strsql = "SELECT DivisionID, Division, DivisionName, Description " & _
"FROM " & strTableName & " " & _
"WHERE Division = 'SFP'"
DoCmd.DeleteObject acQuery, "qryMyQuery"
Set qdfMyQuery = dbsCurrent.CreateQueryDef("qryMyQuery", strsql)
DoCmd.OpenQuery "qryMyQuery"
End Sub
.
- References:
- Query base on a changing table
- From: NomoreSpam4Me@xxxxxxxxxxx
- Query base on a changing table
- Prev by Date: Re: A-97 Alzheimer moment... what were the basic components of securing an app?
- Next by Date: Re: Is it difficult for a hidden form to check for user activity every 15-seconds or so?
- Previous by thread: Query base on a changing table
- Next by thread: Update Query with User-defined function?
- Index(es):