193ef build a query via vba
Sign Up |  Live StatsLive Stats    Articles 37,469| Comments 178,626| Members 19,494, Newest Kartarsingh| Online 476
Home Contact
 (Forgotten?): 
    10 years of Excellence
    For best SPN experience, use Firefox Internet Browser!


                                                                   Your Banner Here!    




Click Here to Register/Sign Up Daily Hukamnama Member Blogs Downloads Website Navigation Help Fonts Tags

build a query via vba

Our Donation Goal : Why Donate? : Donate Today! : Donate Anonymously (ਗੁਪਤ) : Our Family of Supporters
Goal this month: 500 USD, Received: 0 USD (0%)
Please Donate...
     
Related Topics...
Thread Thread Starter Forum Replies Last Post
Are Nihangs: A Legacy to Behold and a core to Build from? Ambarsaria Controversies 33 20-Feb-2012 22:16 PM
Google’s Quest to Build a Better Boss spnadmin Jobs & Employment 0 13-Mar-2011 06:36 AM
Religion doesn't build civilization spnadmin Interfaith Dialogues 0 18-Oct-2010 06:50 AM
Multiply a Rates Query with a Volumes Query - sounds simple! access user Information Technology 5 28-Jul-2006 08:29 AM
Sikhs to Build Temple Sikh News Reporter Sikh News 0 07-Mar-2005 07:30 AM


Tags
build, query, via, vba
Reply Post New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!
  #1 (permalink)  
Old 28-Jul-2006, 08:17 AM
yaniv d's Avatar yaniv d
Guest
 
Posts: n/a
   
   
build a query via vba

  Donate Today!   Email to Friend  Tell a Friend   Show Printable Version  Print   Contact sikhphilosophy.net Administraion for any Suggestions, Ideas, Feedback.  Feedback  

Register to Remove Advertisements
i wonder if there is an option to enter SQL sentence in order to change
its structure and data via vba code
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/10951-build-a-query-via-vba.html


*







Do you agree or disagree with the writer above? Why not share your immediate thoughts with us! Login Now! or Sign Up Today! to share your views... Gurfateh!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 28-Jul-2006, 08:17 AM
Nikos Yannacopoulos's Avatar Nikos Yannacopoulos
Guest
 
Posts: n/a
   
   
Re: build a query via vba

Yaniv,

Most likely yes, but you have to be more specific in order to get a
specific reply! What exactly do you want to do?
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10951

Nikos
Reply With Quote
  #3 (permalink)  
Old 28-Jul-2006, 08:17 AM
yaniv d's Avatar yaniv d
Guest
 
Posts: n/a
   
   
Re: build a query via vba

ok,thanks for your replay.
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10951
my issue is as follow.
i want to build maketable query that will be dinamic,that means that
through vba,i will be able to change everytime(depending on my groups)
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10951
the structure of the make table,so it will be dinamicly make table from
diffrent groups
for example:
one form will automatic create a table of animals
second form will automatic create a table of flowers
and ctr..

but of course all of them should be working from one query make-table

Nikos Yannacopoulos wrote:
> Yaniv,
>
> Most likely yes, but you have to be more specific in order to get a
> specific reply! What exactly do you want to do?
>
> Nikos


Reply With Quote
  #4 (permalink)  
Old 28-Jul-2006, 08:17 AM
Douglas J Steele's Avatar Douglas J Steele
Guest
 
Posts: n/a
   
   
Re: build a query via vba

Dim dbCurr As DAO.Database
Dim qdfCurr As DAO.QueryDef
Dim strSQL As String

strSQL = "SELECT ...."
Set dbCurr = CurrentDb()
Set qdfCurr = dbCurr.QueryDefs("MyQuery")
qdfCurr.SQL = strSQL

--
Doug Steele, Microsoft Access MVP
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10951
http://I.Am/DougSteele
(no e-mails, please!)


"yaniv d" wrote in message
news:1149663498.822467.54570@g10g2000cwb.googlegro ups.com...
> i wonder if there is an option to enter SQL sentence in order to change
> its structure and data via vba code
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10951
>



Reply With Quote
  #5 (permalink)  
Old 28-Jul-2006, 08:17 AM
yaniv d's Avatar yaniv d
Guest
 
Posts: n/a
   
   
Re: build a query via vba

hi thanks for your help,
i'm woring on ADO,can you give me a code for it
Douglas J Steele wrote:
> Dim dbCurr As DAO.Database
> Dim qdfCurr As DAO.QueryDef
> Dim strSQL As String
>
> strSQL = "SELECT ...."
> Set dbCurr = CurrentDb()
> Set qdfCurr = dbCurr.QueryDefs("MyQuery")
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10951
> qdfCurr.SQL = strSQL
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10951
>
>
> "yaniv d" wrote in message
> news:1149663498.822467.54570@g10g2000cwb.googlegro ups.com...
> > i wonder if there is an option to enter SQL sentence in order to change
> > its structure and data via vba code
> >


Reply With Quote
  #6 (permalink)  
Old 28-Jul-2006, 08:17 AM
Nikos Yannacopoulos's Avatar Nikos Yannacopoulos
Guest
 
Posts: n/a
   
   
Re: build a query via vba

Yaniv,

You don't even need a (saved) query at all in this case... you can just
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10951
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10951
construct your SQL statement in code and execute it without saving it at
all.
As a simple example, suppose there is a table called tblSpecies, and you
want to filter on field SpeciesType (animal, flower etc) and create a
new table called tblSpeciesOfType; filter selection is made by means of
a combo box (cboSpeciesType) on a form, and the make-table query is run
by clicking a command button on the same form. The code behind the
command button would look something like:

Dim strSQL As String
If IsNull(Me.cboSpeciesType) Then
MsgBox "No species type selected.", vbExclamation, _
"Error Creating Table"
Exit Sub
End If
strSQL = "SELECT * INTO tblSpeciesOfType FROM tblSpecies " & _
"WHERE SpeciesType = '" & Me.cboSpeciesType & "'"
CurrentDb.Execute strSQL, dbFailOnError

This will overwrite the table if it already exists.

That said, are you positive you need to create a new table? Why don't
you just filter on the existing one(s) by means of a Select query?
Duplication of data is not advisable for a number of reasons, having to
do with data integrity and maintenance, storage space etc. Elaborate if
you need further help.

HTH,
Nikos
Reply With Quote
  #7 (permalink)  
Old 28-Jul-2006, 08:17 AM
Douglas J Steele's Avatar Douglas J Steele
Guest
 
Posts: n/a
   
   
Re: build a query via vba

As NIkos points out, you may not require anything.

While it is possible to use ADOX to accomplish the same, since you're
dealing with QueryDef objects in a Jet database, you're better off using
DAO. There's no problem using both ADO and DAO in the same application: I do
it all the time.
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10951

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10951


"yaniv d" wrote in message
news:1149682431.357014.200250@f6g2000cwb.googlegro ups.com...
> hi thanks for your help,
> i'm woring on ADO,can you give me a code for it
> Douglas J Steele wrote:
> > Dim dbCurr As DAO.Database
> > Dim qdfCurr As DAO.QueryDef
> > Dim strSQL As String
> >
> > strSQL = "SELECT ...."
> > Set dbCurr = CurrentDb()
> > Set qdfCurr = dbCurr.QueryDefs("MyQuery")
> > qdfCurr.SQL = strSQL
> >
> > --
> > Doug Steele, Microsoft Access MVP
> > http://I.Am/DougSteele
> > (no e-mails, please!)
> >
> >
> > "yaniv d" wrote in message
> > news:1149663498.822467.54570@g10g2000cwb.googlegro ups.com...
> > > i wonder if there is an option to enter SQL sentence in order to

change
> > > its structure and data via vba code
> > >

>



Reply With Quote
  #8 (permalink)  
Old 28-Jul-2006, 08:17 AM
yaniv d's Avatar yaniv d
Guest
 
Posts: n/a
   
   
Re: build a query via vba

  Donate Today!  
hi douglas,
thanks for your review.
my goal is to make my tool as dinamic as possible,one form and one
query modular for all the group(47 of them) so it will be easy to
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10951
maintain for later on and small in the size for the local hard drive.
i believe the direction that you and nikos gave me will give me some
path.
the issue is that i dont want to add any referenced object to my tool
that when i dont know if i dont know how it will react in the client
desktop.(means i prefer to use the current object rather then to worry
if the activeX is istalled or not,please correct me if im wrong).

thanks again for both of you

Douglas J Steele wrote:
> As NIkos points out, you may not require anything.
>
> While it is possible to use ADOX to accomplish the same, since you're
> dealing with QueryDef objects in a Jet database, you're better off using
> DAO. There's no problem using both ADO and DAO in the same application: I do
> it all the time.
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10951
>
>
> "yaniv d" wrote in message
> news:1149682431.357014.200250@f6g2000cwb.googlegro ups.com...
> > hi thanks for your help,
> > i'm woring on ADO,can you give me a code for it
> > Douglas J Steele wrote:
> > > Dim dbCurr As DAO.Database
> > > Dim qdfCurr As DAO.QueryDef
> > > Dim strSQL As String
> > >
> > > strSQL = "SELECT ...."
> > > Set dbCurr = CurrentDb()
> > > Set qdfCurr = dbCurr.QueryDefs("MyQuery")
> > > qdfCurr.SQL = strSQL
> > >
> > > --
> > > Doug Steele, Microsoft Access MVP
> > > http://I.Am/DougSteele
> > > (no e-mails, please!)
> > >
> > >
> > > "yaniv d" wrote in message
> > > news:1149663498.822467.54570@g10g2000cwb.googlegro ups.com...
> > > > i wonder if there is an option to enter SQL sentence in order to

> change
> > > > its structure and data via vba code
> > > >

> >


Reply With Quote
   Click Here to Donate Now!

Support Us!
Become a Promoter!
Gurfateh ji, you can become a SPN Promoter by Donating as little as $10 each month. With limited resources & high operational costs, your donations make it possible for us to deliver a quality website and spread the teachings of the Sri Guru Granth Sahib Ji, to serve & uplift humanity. Every contribution counts. Donate Generously. Gurfateh!
ReplyPost New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!

Bookmarks


(View-All Members who have read this thread : 0
There are no names to display.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Tools Search
Search:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

» Active Discussions
Difference in Bowing...
By Kamala
Today 15:08 PM
11 Replies, 242 Views
Can Sikhs worship...
By Kamala
Today 15:02 PM
0 Replies, 1 Views
What Really Happened on...
Today 12:46 PM
13 Replies, 187 Views
English Sri Guru Granth Sahib Ji Translations
Today 12:22 PM
3 Replies, 63 Views
Free Online Gurbani...
Today 03:56 AM
13 Replies, 4,324 Views
English Sri Guru Granth...
Today 03:51 AM
5 Replies, 167 Views
Edward Snowden: the...
Today 03:34 AM
3 Replies, 157 Views
Rozana Reports (ਪੰਜਾਬੀ...
Today 03:23 AM
407 Replies, 9,423 Views
Sikh Spokesman (ਪੰਜਾਬੀ...
Yesterday 17:57 PM
255 Replies, 6,052 Views
What Is Difference...
Yesterday 09:18 AM
6 Replies, 181 Views
First There is Water by...
By Ishna
Yesterday 05:03 AM
3 Replies, 190 Views
Cooking Without Alcohol
Yesterday 02:12 AM
12 Replies, 195 Views
Learning from Baba...
Yesterday 01:38 AM
0 Replies, 312 Views
Eckhart Tolle
17-Jun-2013 18:08 PM
2 Replies, 125 Views
Thought of the Moment!
17-Jun-2013 16:35 PM
115 Replies, 6,092 Views
» Books You Should Read...
Powered by vBadvanced CMPS v3.2.3
All times are GMT +6.5. The time now is 15:24 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2 Copyright © 2004-12, All Rights Reserved. Sikh Philosophy Network


Page generated in 0.48003 seconds with 32 queries
0