Help: VB5.0 Select Stmt's 
Author Message
 Help: VB5.0 Select Stmt's

I am programming a database in VB5.0 & Access97 and am having difficulty
with the 'WHERE' clause in a 'SELECT' statement.  I am attempting to
select the value of a field of in a database table using a string that
has been entered into a textbox as a search argument.  The select
statement is giving the followint error message: 'too few parameters.
expected 1'.

For example: data1.recordsource = select firstname from student where
studentssn = socialtext.text

where 'socialtext.text' is the textbox string I am using as the
argument.

I would appreciate any help provided.

Thanks.

Raul



Sat, 05 Feb 2000 03:00:00 GMT  
 Help: VB5.0 Select Stmt's

Hello Raul,

The problem is that Jet has no way to recognize the string
"socialtext.text", but you can still use it like so:

     data1.recordsource = "select firstname from student where studentssn =
'" & socialtext.text & "'"

This way, the value of socialtext.text is extracted by VB, concatenated into
the SQL string BEFORE the string is assigned to the recordset property.

I hope this helps,

--

Larry R. Tubbs Jr., MCPS, MCSD
Silverleaf Resorts Inc, NYSE: SVR

http://www.geocities.com/ResearchTriangle/5727/


Quote:
>I am programming a database in VB5.0 & Access97 and am having difficulty
>with the 'WHERE' clause in a 'SELECT' statement.  I am attempting to
>select the value of a field of in a database table using a string that
>has been entered into a textbox as a search argument.  The select
>statement is giving the followint error message: 'too few parameters.
>expected 1'.

>For example: data1.recordsource = select firstname from student where
>studentssn = socialtext.text

>where 'socialtext.text' is the textbox string I am using as the
>argument.

>I would appreciate any help provided.

>Thanks.

>Raul



Sun, 06 Feb 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. SELECT stmt use '*'

2. View doesn't Work but the Select Stmt Does

3. Correlated subquery in DELETE stmt not work in Access '97 or 2000

4. SqlClient.SqlTransaction help with 'select'

5. Help:Is there a way for a CALL stmt to call any procedure

6. Nested BeginTrans/Rollback stmt error - need help

7. Help With INSERT Stmt

8. help needed trying to make the declare function stmt more flexible

9. Help with SELECT in VB5

10. excel vba - help finding designated text within string and deleting selected range's row

11. Help with SELECT in VB5

12. HELP: Selecting 1000's of rows in SSDBGrid

 

 
Powered by phpBB® Forum Software