Using Excel range of cell values for ms query single paramter - sql

I have an excel sheet with two fields: list of user id, and corresponding create date. I want to query from an external database having around million records by only returning records where user_id in (?). How can i pass a range of id's like $A1:A17 as the single parameter to the query?

One option to achieve the same result using another method would be to create a temporary table with just one column for user_id.
Then you could run the query and do:
where user_id in (select user_id from my_temp_table)

Related

Retrive unique records from an access table which does not have a fixed structure

I want only the unique records in same or new table. And I want to do this with different tables (having duplicate records) in access database through same code.
The flow should be like:
input table ------VBA MODULE------> table with unique records
I am able to do this group by function but for that i have to use field names in query. But field names will differ from table to table.
Please help!
Just use query
SELECT DISTINCT * FROM MyAnyTable

How to repeat records in access table number of times

I need your assistance to figure out how to achieve the following in MS access database.
I have a table with a lot of columns but one of them has a numeric value that will be used as how many times will the record will be repeated.
I need to make another table with repeated records based on Count column.
Build a numbers (aka tally) table (you can google it). I'll call it tblNumbers. Then all you need to do is create a query SELECT <yourTable>.* FROM <yourTable>, tblNumbers WHERE tblNumbers.Number <= <yourTable>.<numberField>

Get fields from one column to another in Access

Below i have a table where i need to get fields from one column to three columns.
This is how i would like the data to end up
Column1
Music
Column2
com.sec.android.app.music
Column3
com.sec.android.app.music.MusicActionTabActivity
Give the table a numeric autonumber id
Remove the rows with no data with a select where blank spaces or null
Find records with no point in the content with a select
Use the previous query as a source and use the id to find the id + 1 to find the next record and do the same with + 2 to find the second row
Build a table to hold the new structure and use the query as a source to insert the new created data in the new table with the 3 columns structure.
This is an example using sql server
Test table design
Data in table
Query
Look at the query from the inside. The first query inside clean the null records. Then the second query find the records with out point. This records are the reference to find the related two records. Then the id of the records with out point are used to make a query in the select adding 1 for the next record and then other query adding 2 to find the other record. Now you only need to create a table to insert this data, using this query as the source.

How to Use dynamic column name in vb.net (with visual studio 2005)

Hi I am creating an attendance system where i want that for a particular id given by user, attendance of that id get saved in the MS access sheet.
What i am wanting is that column name should be i date format pre created by me nad as user enters the id the program retrieves date from system and based on that date (taking it to be dynamic column name) writes an p on them.
I am using SQL query to update i.e using update statement
now i am unable to find correct syntax for using dynamic column name..
So can any one help me??
If I understand what you are saying... I would change the schema you are envisioning to have a table with "ID" and Date Columns. This prevents you from having a fixed and huge number number of date columns.
You insert a new row in this table for an ID and date combination.
I am also assuming you want a report that pivots the data where you have ID in Column position 0 and dates as column headers? Since you are using Access you can create a Cross Tab Query
(pivot) to accomplish this.

Inserting a query with a 'static' form field into a table

i'm trying to keep a record of which customers have received which newsletters. I have a query called
TempQuery
I want to take the field
TempQuery.CustID
That consists of several numerical id's and combine it with two static values specified on a form
Forms![frmAddCorrespondence]![txtNID]
Forms![frmAddCorrespondence]![txtDate]
such that I end up with something like
CustID NID Date
1 5 28/03/2011
3 5 28/03/2011
14 5 28/03/2011
56 5 28/03/2011
Again the fields NID and Date will be the same values for each individual insert specified on frmAddCorrespondence and the CustID's are pulled from TempQuery.
I'd like this to be a query from which the data can be inserted into a log table of all our past correspondences.
Any help is greatly appreciated
Thanks, Rob
you want a full outer join between your temp query and the date and ID entered at runtime?
If so, you can pass the two new column values (ID and date) as parameters to your query. Just create a new query based on your existing one and add the two control references as new columns.
Is that what you wanted?
In response to your comment, yes, you can create a second append query in Access that takes all the columns from your query and adds the two parameters from the controls on your form.