473,385 Members | 1,453 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Query base on a changing table

Hi there, this is my situation:

I have a query base on table.
But every week i get a new table and i dont want to have to go in my
query and maje the change. Is there a way i can have a pop up window
asking me on what table i want my query base on?

Like a criteria for a field. But in this case i'm not looking for a
field but more for a table.

thx a lot.

bye the way i'm using Win XP with Acess 03.

Nov 13 '05 #1
1 1228
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

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Matthew Wells | last post by:
I have a crosstab query based on anothe query. The base query resultset has no null values in its "Quantity" column. However, when I create the new crosstab query from the base query, the records...
10
by: Marizel | last post by:
I'm not sure there's an easy solution to this, but thought I'd ask. I often find myself with a query which I'd like to reuse, but with a different datasource. These datasources generally have...
2
by: Jwhal | last post by:
I'm having trouble querying one table with multiple entries. I'm not sure if or what kind of joins I need to do this, or if it should be a make table followed by an append, then an update, or what....
4
by: Bob Sanderson | last post by:
I am using a form to select a table and then opening a report using the selected table as the record source. This is a simplified description of what I'm doing. First, cboSelectBOM selects the...
0
by: leavandor | last post by:
I am trying to design a query that works with a relationship between a Table and a Query. I am comparing a value in the table with a computed value inside the query. The reason for this is that...
2
by: Alex Scollay | last post by:
Let's say I have a column whose values are all 2-digit integers, e.g. 82 (though it's actually a varchar field). From now on, the column will be able to have 2-digit as well as 3-digit integers....
3
by: ss908 | last post by:
I have records in a source table. Each is tagged either Base or Add or Delete (from Base) How do I create another table which shows Base records plus Add records and deletes Base records which are...
15
by: Widge | last post by:
Hi, I wondered if you could help me with an issue I'm having. Currently I have a rebate calculation that is running off two tables: 1) A list of suppliers and the rebate %ages relevant to them...
0
by: anvidc | last post by:
Hi everyone.. How to filter table1 base on an query from a table2 which is no join. Here is some picture for you to understand my question: Table 1 UserID -> Unique ID No. Name Company
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.