I am trying to use VB to access a query in a MS Access Database and pass in a variable to run this query storing the query results in a recordset in VB. I am not very sure this is possible.
In other words I am using vb to pass the "Eqnum" variable to an Access Query and want to store the results in a recordset in vb called "rs"
Here's what I have so far, I have tried countless ways of doing this and had no luck ( the biggest problem is I dont really know what I am doing) Any help would be greatfully appreciated
Sub reprintlabel(Eqnum As String) Dim cn As ADODB.Connection Dim rs As ADODB.Recordset Set cn = New ADODB.Connection Set rs = New ADODB.Recordset Str = "\\DATACHECK.MDB" cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Str + ";Persist Security Info=False" cn.CursorLocation = adUseClient ssql = "SELECT Nra3.WONUM FROM DATACHECK.Nra3 ?????????????? rs1.Open ssql1, cn, adOpenStatic, adLockReadOnly
I dont think that even the connect part is right as when I put in a ordinary select query and try to run it I get a compile error option not available. The database is currently just on my c drive, do I need to specify this? Thanks again for your help.