-
Adodc cmdtext issue
Hi People
i am having a problem with my recordsource below it says invalid use of property and highlights Text18
i need to pull data out of my database table (Access 2003) and only show the CDB Numbers that reside between the two dates that get selected during runtime please can you have a look below
the field it needs to look in is called Visit Date but it can be changed
Adodc3.CommandType = adCmdText
Adodc3.RecordSource "Select * From Reports where [Visit Date] LIKE '" & Text17 & "' and > '" & Text18 & "'"
Adodc3.Refresh
DataList1.RowSource = Adodc3
DataList1.DataSource = Adodc3
DataList1.DataField = "NWC CDB"
DataList1.ListField = "NWC CDB"
Adodc3.Refresh
DataList1.Refresh
where text17 = start date and
text18 = end date
many thanks in advance
Rob
-
Looks like you're missing an equals sign (should be RecordSource = "Select ..."), and I think your SQL should look like this:
"Select * From Reports where [Visit Date] LIKE '" & Text17 & "' and [Visit Date] > '" & Text18 & "'"
Finally, be aware that the above SQL will fail if Text17 or Text18 contain an apostrophe.
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
-
thanks Phil
thanks Phil
do you have any idea as to why it tells me invalid use of property where as
DataList1.RowSource = Adodc3 is concerned
DataList1.DataSource = Adodc3
DataList1.DataField = "NWC CDB"
DataList1.ListField = "NWC CDB"
many thanks in advance
Rob
-
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
-
still a bit baffled
HI all
Adodc3.RecordSource = "Select * From Reports where [Visit Date] LIKE '" & Text17 & "' and [Visit Date] > '" & Text18 & "' where [Report Type] Like '" & Text47 & "'"
is there any problems that you can see within this above search string
text17 = Start date
text18 = End Date
Text47 = What needs to be looked for between those two dates
it just gives me the rror as follows
Syntax error (missing operator) in query expression
any help is appreciated thanks
Rob
-
"Select * From Reports where [Visit Date] LIKE '" & Text17 & "' and
[Visit Date] > '" & Text18 & "' where [Report Type] Like '" & Text47 & "'"
First remark: Only use 1 where, this is not a correct SQL syntax.
Second remark: I doubt if you want to use Like, like is normally used together with wildcards, if you want to search a specified value simple use =.
This should be the outcome then:
Code:
"Select * From Reports where [Visit Date]='" & Text17 & "' and
[Visit Date] > '" & Text18 & "' and [Report Type]='" & Text47 & "'"
If you search a text you use ' number -> nothing, date -> #. The field of the database must be a datafield ofcourse + you have to transfer your date textbox-value to date.
I'll post back to you when I've made an example
Benjamin
-
thanks Mate
i am trying to create a search string but none of them seem to be working for me i have now tried to use the string as a recordset for an ADODB connection but it does not like it either
i feel like pulling my hair out lol
but i keep trying
Thanks
Benjamin
Similar Threads
-
By Tim Johnson in forum VB Classic
Replies: 4
Last Post: 09-12-2002, 09:27 AM
-
By Thomas Eyde in forum .NET
Replies: 290
Last Post: 12-22-2001, 02:13 PM
-
By Saurabh in forum dotnet.announcements
Replies: 0
Last Post: 09-19-2001, 06:48 AM
-
By Greg Cantlon in forum VB Classic
Replies: 2
Last Post: 01-27-2001, 01:10 AM
-
By Greg Cantlon in forum VB Classic
Replies: 0
Last Post: 01-25-2001, 06:23 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks