List Info

Thread: Re: Re: VB to Access - Select query errors out........




Re: Re: VB to Access - Select query errors out........
country flaguser name
United States
2008-03-16 06:28:39

Hi

How do u design a query or recordset ??


Dim db As Database
Dim currentdir As String
Dim sStrSql As String
currentdir = App.Path & "AddressBook_Converted.mdb"
Set db = DBEngine.OpenDatabase(currentdir)

sStrSql = "select DISTINCT City from AddressBook"


db.Execute sStrSql
db.Close

guide me for the above scenario.. please
bdloving < bdloving%40yahoo.com">bdlovingyahoo.com> wrote:
Executing a Select like this will not return records to you.
you will need to design a query or a recordset based on the sStrSql

--- In visualbasic6programming%40yahoogroups.com">visualbasic6programmingyahoogroups.com, goms theetha
<goms_theetha...> wrote:
&gt;
> Hi,
>
>
> When i try to select unique city from the table, i get cannot
execute select query...
> Sample code i used for doing the above operation:
> Dim db As Database
> Dim currentdir As String
&gt; Dim sStrSql As String
&gt; currentdir = App.Path & "AddressBook_Converted.mdb"
&gt; Set db = DBEngine.OpenDatabase(currentdir)
> sStrSql = "select DISTINCT City from AddressBook"
&gt; db.Execute sStrSql
> db.Close
>
> can i please know wat mistake i did... please let me know the
solution...
&gt;
> Thanks
> Gomathi
>
>
> ---------------------------------
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile.
Try it now.
>;
> [Non-text portions of this message have been removed]
>

---------------------------------
Never miss a thing. Make Yahoo your homepage.

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )