Help me with this VBA code

clerics

Registered User.
Local time
Tomorrow, 00:16
Joined
Nov 28, 2005
Messages
82
:o just a small problem:

i have this code :
Me.SQLview = Me.Info.RowSource

in my program. that means i want to take SQL string . it's right if Me.Info.RowSource is an SQL string, but not if Me.Info.RowSource is an query(just take the name of query but can't take SQL string). any one have experience with this please help me ..... :( :o :p ...Thanks
 
I think
Me.SQLview = Me.Info.SQL

Peter
 
sorry friend !
Me.Info is a ListBox ..
So... ACCESS do not have "Me.Info.SQL"
i try to find in this forum but it's seem to be a small problem , that's why i can't not find out !
 
dim q as dao.querydef
set q = currentdb.querydefs(Me.Info.RowSource)
Me.SQLview = q.SQL
set q = nothing
 
or even just

Me.SQLView = CurrentDb.QueryDefs(Me.info.RowSource).SQL

of course I have no idea for what purpose one would want to do this.....
 
if you have the name of the query from the list you can use querydef and .SQL to get the SQL from the query.

HTH

Peter
 
thanks a lot for all of your suggetions. You all 're right if Me.Info.RowSource is an query ... that closes to my question ... just a little more -->
i don't know exactly when Me.Info.RowSource is an query or SQL . If it was an query that would be ok but if it was an SQL your code would be wrong .
Have any condiction to seperate it ? im so sorry cuz my stupid question make you go down ...but please help me friend !
 
you could test that is returned for the rowscource. I never use spaces in query names so if there is a space then it would be SQL

HTH

Peter
 
what an inteligent idea ! ... that's sound interesting... Thanks alot, friend!
 

Users who are viewing this thread

Back
Top Bottom