PDA

Click to See Complete Forum and Search --> : My select statement does not work


maqmaq
Oct 10th, 2000, 08:26 AM
When I run this command:

Private Sub Command7_Click()
'CRI is the table name
'stock is the field name
mySQL = "SELECT * FROM cri WHERE stock Like '[89]*';"
Data1.RecordSource = mySQL
Data1.Refresh
End Sub

I am getting this error:

Too few parameters. Expected 1. (Error 3061)
What could be wrong with it...

Any help...
Appreciated in advance

[Edited by maqmaq on 10-10-2000 at 09:30 AM]

HunterMcCray
Oct 10th, 2000, 09:03 AM
Originally posted by maqmaq
When I run this command:

Private Sub Command7_Click()
'CRI is the table name
'stock is the field name
mySQL = "SELECT * FROM cri WHERE stock Like '[89]*';"
Data1.RecordSource = mySQL
Data1.Refresh
End Sub

I am getting this error:

Too few parameters. Expected 1. (Error 3061)
What could be wrong with it...

Any help...
Appreciated in advance

[Edited by maqmaq on 10-10-2000 at 09:30 AM]

I would guess that it is the brackets, but I would suggest changing some other syntax:

strSQL="SELECT cri.* FROM cri WHERE cri.stock = 89;"

Unless you have a field named 'stock' that is a text field (WHY?) you cannot use "LIKE" as a comparison. 'LIKE' is a string comparison. Use simple arithmetic operators like "<>=". If you are using a string comparison for a field named "stock" (WHY?) then you should remove the brackets from around it. I think that the error that you are recieving is a type-mismatch error....but I have not looked it up.

Hope This Helps,

Hunter