473,385 Members | 2,015 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.

Want to create a make table query using vba

Hi I am newbie, can you please help me to create this query through vba
Expand|Select|Wrap|Line Numbers
  1. SELECT [010710_pri].Field1, [010710_pri].Field2, [010710_pri].Field3, [010710_pri].Field4, [010710_pri].Field5
  2. FROM 010710_pri
  3. GROUP BY [010710_pri].Field1, [010710_pri].Field2, [010710_pri].Field3, [010710_pri].Field4, [010710_pri].Field5
  4. HAVING (((Count(*))=1));
  5.  
I want to create a make table query.
Jan 12 '10 #1
4 5719
nico5038
3,080 Expert 2GB
Just change the type from SELECT Into "Make Table".
The type can be set in the header menu / Ribbon.

Nic;o)
Jan 12 '10 #2
Hi Nico,
Thanks for your reply, however my below mentioned command button is not working can you please take a look?
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command5_Click()
  2. On Error Resume Next
  3. Dim dbs As Database
  4. Dim strSQL As String
  5. Dim strQueryName As String
  6. Dim qryDef As QueryDef
  7. Set dbs = CurrentDb()
  8. strQueryName = "Query1"
  9. dbs.QueryDefs.Delete strQueryName
  10. Set qryDef = dbs.CreateQueryDef(strQueryName, strSQL)
  11. DoCmd.RunSQL ("SELECT [010710_pri].Field1, [010710_pri].Field2, [010710_pri].Field3, [010710_pri].Field4, [010710_pri].Field5" & _
  12. "INTO 010710" & _
  13. "FROM 010710_pri" & _
  14. "GROUP BY [010710_pri].Field1, [010710_pri].Field2, [010710_pri].Field3, [010710_pri].Field4, [010710_pri].Field5" & _
  15. "HAVING (((Count(*))=1));")
  16. End Sub
  17.  
Regards,
Sam
Jan 12 '10 #3
nico5038
3,080 Expert 2GB
Just put the whole string into a query (open the SQL mode with the button top left), test it and finally save it and use in your code:
Expand|Select|Wrap|Line Numbers
  1. currentdb.execute ("qryInsert")
  2.  
I do have some hesitations about using a number as tabelname, try to start every table with "tbl" as a prefix !

Nic;o)
Jan 12 '10 #4
MMcCarthy
14,534 Expert Mod 8TB
Please use code tags when posting code

Check out How to ask a question
Jan 12 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: teddysnips | last post by:
Application is a Work Tracking/Timesheet database. The increments of work are stored in the TimesheetItem table. This contains, inter alia, the Work Code, the Start and the Duration that the...
18
by: PC Datasheet | last post by:
An Access user saw my name in a newsgroup and sent me a request for help on a project. As part of the project, a list of the dates in a month was needed. For anyone needing a list of dates in a...
19
by: Lyle Fairfield | last post by:
MSDN Home > MSDN Library > Win32 and COM Development Data Access Microsoft offers many data access technologies to suit various development needs. This section of the MSDN Library contains...
4
by: Owen Jenkins | last post by:
Hi, No-one replied to this when I sent it last week. Any bites out there today?? ----- My application allows users to create a new back end for separate purposes. It does this by using Make...
15
by: KayCee | last post by:
I am using Access 2000 I have three tables I am using to create a query that will be used for a data entry form. Table one - Client List, Table two - Services, Table three - Due Dates. I want...
4
by: Mark | last post by:
Hey folks, I'm looking at making the following query more efficient potentially using the ranking functions and I'd like some advice from the gurus. The purpose of the following is to have a...
2
by: gvijayasurya | last post by:
11. What are the different tables present in mysql, which type of table is generated when we are creating a table in the following syntax: create table employee(eno int(2),ename varchar(10)) ? 12....
3
by: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however,...
12
by: tekctrl | last post by:
Environment; Win2K PC with 1Gb of RAM and plenty of HD space running Access 2002 Issue; Access presents a blank data entry form in the Forms view when the New Record icon is used. However, it...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.