SQL Help Needed - ADO & MS Access 
Author Message
 SQL Help Needed - ADO & MS Access

    I'm trying to read items from a combo box and I'm having trouble passing
it's values into a SQL statement.  Does anyone know the syntax?  I'm using
ADO controls and I'm accessing a MS access db.  When I try to run the
statement I get 'no value given for one or more required parameters and then
a method 'refresh' failed message.  If I replace CboFindFirst.Text  with
'Steve' or any other string the query works fine.  Can anyone provide any
help?  A sample of what I'm doing is below.  Thank you.

Dim varName As String
    varName = CboFindFirst.Text

    strMessage = varName                     'Used for testing purposes
    MsgBox strMessage

    AdoEmp.RecordSource = "SELECT * FROM Tbl_Employees WHERE First_Name =
CboFindFirst.Text "
    AdoEmp.Refresh



Sun, 08 Sep 2002 03:00:00 GMT  
 SQL Help Needed - ADO & MS Access
Try:
        WHERE First_Name='" & CboFindFirst.Text & "'"


Quote:
>     I'm trying to read items from a combo box and I'm having trouble
passing
> it's values into a SQL statement.  Does anyone know the syntax?  I'm
using
> ADO controls and I'm accessing a MS access db.  When I try to run the
> statement I get 'no value given for one or more required parameters
and then
> a method 'refresh' failed message.  If I replace CboFindFirst.Text
with
> 'Steve' or any other string the query works fine.  Can anyone provide
any
> help?  A sample of what I'm doing is below.  Thank you.

> Dim varName As String
>     varName = CboFindFirst.Text

>     strMessage = varName                     'Used for testing
purposes
>     MsgBox strMessage

>     AdoEmp.RecordSource = "SELECT * FROM Tbl_Employees WHERE
First_Name =
> CboFindFirst.Text "
>     AdoEmp.Refresh



Sun, 08 Sep 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. MS Access & ADO - Recordset needs reset

2. Help Ado & MS SQL Server

3. Need help: jpegs, vb4, & ms access

4. Need to xport SQL Stored procs to MS Excel from ADO.net

5. error using SQL SHAPE with ADO and MS-ACCESS

6. error using SQL SHAPE with ADO and MS-ACCESS

7. Visual Basic, SQL, and MS Access Programmers Needed

8. ADO (SQl & Access)

9. Seeking help with: VB, COM+, MS-DTC, ADO, SQL Server

10. sql-problem ADO - MS Sql Server

11. Need help for RDO with MS SQL Server 6.0

12. I need help with SQL in a VB program to access an Access database

 

 
Powered by phpBB® Forum Software