0

Okay here is my code:

If optName.Value = True Then
Dim strSQL As String
strSQL = "SELECT * FROM Usages WHERE UsageID = " & List2.Text & ""
Adodc1.RecordSource = strSQL
Adodc1.Refresh

Refresh is causing an error in from clause??
I tried setting my adodc1 to an adcmdunknown recordsource, with no avail. i then get no recordsource specified error.

please help me with this, i am at my wits end. i have looked it up, i can't find the answer anywhere. the microsoft website has an explanation but i can't figure out how to solve it.

:(

3
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by dbdork
0

Hi,

In your database table, if UsageID is Text/String, then you need to wrap the value with single quotes...
strSQL = "SELECT * FROM Usages WHERE UsageID = '" & List2.Text & "'"

Also check Database File (In case of access) is properly set..

Regards
Veena

0
'if your list2.text is a Number 
strSQL = "SELECT * FROM Usages WHERE UsageID = " & Cint(List2.Text) & ""

A String is a String...
A number is a Number..

0

it is a string, however List2.Text is a listbox.

Is is possible to query a table from a listbox?

would this require some sort of an array?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.