I declare the recordset in the public sub routine below. I created a button and move through the recordset. I am trying to find maybe a data control or something I can use?
Public Sub LoadScreen(ByRef sServer As Object, ByRef sLogin As Object, ByRef sPASSWORD As Object, ByRef sDatabase As Object)
'On Error GoTo errorHandler
Dim strDMISName As String
Dim strDMISNumber As String
Dim sconnstr As String
Dim oconn As ADODB.Connection
oconn = New ADODB.Connection
sconnstr = "driver={SQL Server}; server=" & sServer & "; " & "uid=" & sLogin & "; pwd=" & sPASSWORD & "; database=" & sDatabase
oconn.Open(sconnstr)
Dim xrs As ADODB.Recordset
xrs = New ADODB.Recordset
Dim fld As ADODB.Field
xrs.Open("SELECT * FROM FLOC", oconn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly)
If xrs.BOF And xrs.EOF Then
Exit Sub
End If
xrs.MoveFirst()
xrs.MoveNext()
'Do While Not rs.EOF
Me.TextBox2.Text = xrs.Fields("Interface Code").Value
xrs.MoveNext()
rs.Close()
rs = Nothing
oconn.Close()
oconn = Nothing
Exit Sub
errorHandler:
MsgBox(Err.Description)
End Sub