Help with SQL stements 
Author Message
 Help with SQL stements

I need an SQL statement the collects from a name table only those
names that start with A, B or C and when it fills the bound
textboxes with the results it puts the State Name in the text box
which is bound to the stateKey field in the main table and the
name is in the StateNames table.  As it is right now it creates
the recordset and displays the first record and the statename =
43.

Sub Form_Load()
    Dim strSQL as string

    strSQL = "SELECT * FROM MyContacts"

    with datMain
        .Recordsource=strSQL
        .Refresh
    end with

End Sub

Thanks for your help.

Scott



Thu, 14 Oct 2004 23:04:43 GMT  
 Help with SQL stements

Quote:

> I need an SQL statement the collects from a name table only those
> names that start with A, B or C and when it fills the bound
> textboxes with the results it puts the State Name in the text box
> which is bound to the stateKey field in the main table and the
> name is in the StateNames table.  As it is right now it creates
> the recordset and displays the first record and the statename =
> 43.

> Sub Form_Load()
>     Dim strSQL as string

>     strSQL = "SELECT * FROM MyContacts"

>     with datMain
>         .Recordsource=strSQL
>         .Refresh
>     end with

> End Sub

> Thanks for your help.

> Scott

you need to look at the help text for the WHERE clause of the sql statement.

select * from table where fieldname = "a*"



Mon, 18 Oct 2004 00:57:51 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. SQL Help - SQL sub-query

2. Access SQL to Visual Basic SQL Help

3. Good Reporting Tool for VB to SQL (Currently Use Crystal) or Crystal w/SQL Help Appreciated

4. SQL Help (WWW to SQL)

5. SQL HELP: Access to SQL Server

6. HELP, I need Somebody, HELP :)) - SQL

7. HELP / HELP / syntax SQL / 'LIKE' clause

8. HELP! Newbie needs help with SQL for VB3

9. SQL help problem. Please help

10. NULL Values in SQL Queries - HELP HELP

11. Using Vbscript and SQL-DMO to connect to SQL Server and run a T-SQL script

12. changing ACCESS sql ro SQL sql

 

 
Powered by phpBB® Forum Software