You will have to execute this statement using one of three objects: ADODB.Connection, ADODB.Command, or ADODB.Recordset
w3schools has very good references for all three in their ADO section, as well as examples of each of these. The basic idea is to use the object to execute the query and then set a recordset object = to the executing statement. When using the Recordset itself to execute (.Open) the query the results will automatically be entered into the recordset object.
w3schools links:
- ADO Introduction
The links on the left side of the page should provide you with everything you need.
-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
For my next trick I will pull a hat out of a rabbit (if you think thats bad you should see how the pigeon feels...)
No, you could create a single SQL statement that would pull in a recordset containing all of your information:
in this case - sqlString = "SELECT transit, name FROM transits WHERE EmpID = " & userinput
This is still a simple string though. You actually have to make a connection to the database and send/execute the query before you will get results back that you can assign to individual variables.
Simple select stataments take the form of:
Code:
SELECT fieldname[,fieldname,fieldname....] FROM tablename[,tablename,tablename] [WHERE condition=value[AND/OR condition2=value2 ...]]
You can also replace the fieldname portion with a * which will allow you to select all the fields from the records that match your criteria.
-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
For my next trick I will pull a hat out of a rabbit (if you think thats bad you should see how the pigeon feels...)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.