scotts27
asked on
Retrieving a single data item from a table
I would like to runa simple select statement:
BooksConnection.Execute "SELECT LineOfText FROM ImportCheck WHERE ProviderID = " & ProviderID & " AND LineNumber = " & Counter
This works. How do I place that one data item (LineOfText) into a variable so I can use it? Does it go into some default recordset? I am not getting an error and I use many SQL statements in my code now for Inserts and deletes
Thanks
BooksConnection.Execute "SELECT LineOfText FROM ImportCheck WHERE ProviderID = " & ProviderID & " AND LineNumber = " & Counter
This works. How do I place that one data item (LineOfText) into a variable so I can use it? Does it go into some default recordset? I am not getting an error and I use many SQL statements in my code now for Inserts and deletes
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Simplke fix to the design time error message.. Change this statement
From:
set rs = BooksConnection.Execute "SELECT LineOfText FROM ImportCheck WHERE ProviderID = " & ProviderID & " AND LineNumber = " & Counter
To:
set rs = BooksConnection.Execute ("SELECT LineOfText FROM ImportCheck WHERE ProviderID = " & ProviderID & " AND LineNumber = " & Counter)
ie. just put parenthesis around your query).. <smile>.
From:
set rs = BooksConnection.Execute "SELECT LineOfText FROM ImportCheck WHERE ProviderID = " & ProviderID & " AND LineNumber = " & Counter
To:
set rs = BooksConnection.Execute ("SELECT LineOfText FROM ImportCheck WHERE ProviderID = " & ProviderID & " AND LineNumber = " & Counter)
ie. just put parenthesis around your query).. <smile>.
ASKER
I have worked around it defining the record set and the select statement and using and rs.cursurlocation and an rs.open statement.
I would like to get it working the way wsh2 suggests if possible. It is much simpler and easier to read. thanks