Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Statemente question 1

Status
Not open for further replies.

quaked2023

Technical User
Joined
Jan 22, 2004
Messages
105
Location
MX
Hello!

I'm trying to get a DBGrid control to display only the records that i want to display... i found this page and gave me an idea of how to do it... but instead of putting the SQL statement in the rocordsource property i put it like this:

Private Sub Command1_Click()
sqlstr = "SELECT Date, Pay FROM Payments WHERE Payments.Code = Label10.Caption"
Data1.RecordSource = sqlstr
Data1.Refresh
End Sub

but every time i try to do it i get run-time error '3061' Too few parameters. Expected 1... What am i doing wrong?... I should mention that i've never used SQL before...

Thanks in advance!

-The Only Privacy Left Is The Inside Of Your Head!- QUAKED2023
 
Hi Quaked2023

I suspect that what you need is

Code:
sqlstr = "SELECT Date, Pay FROM Payments WHERE Payments.Code = " & Label10.Caption

Cassandra
 
Hey Cassandra! Thank you so much! it works great! [2thumbsup]

-The Only Privacy Left Is The Inside Of Your Head!- QUAKED2023
 
You're very welcome!

Thanks for the star!

Cassandra
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top