Private Sub Form_Load()
Dim myDB As ADODB.Connection
Dim rsE As ADODB.Recordset
Dim strEQ As String
If IsLoaded("fEMain") Then
Forms![fEMain].Visible = False
If Forms![fEMain]![lblTicker].Caption = "A" Then
strEQ = "SELECT eid,ename,snpln,dp,location,acost,currentuser,eqptype FROM eqpt WHERE eqptype='Service Vehicle'"
Set myDB = New ADODB.Connection
myDB.CursorLocation = adUseClient
myDB.ConnectionString = connHBK
myDB.Open
Set rsE = New ADODB.Recordset
rsE.Open strEQ, myDB, adOpenStatic, adLockOptimistic
Set Me.Recordset = rsE
If rsE.RecordCount > 0 Then
rsE.MoveFirst
While Not rsE.EOF
Me![eid].Value = rsE("eid")
Me![ename].Value = rsE("ename")
Me![snpln].Value = rsE("snpln")
Me![dp].Value = rsE("dp")
Me![location].Value = rsE("location")
Me![acost].Value = rsE("acost")
Me![currentuser].Value = rsE("currentuser")
rsE.MoveNext
Wend
End If
rsE.Close
Set rsE = Nothing
myDB.Close
Set myDB = Nothing
Me![Label18].Caption = "Plate No"
ElseIf Forms![fEMain]![lblTicker].Caption = "B" Then
'Dim myDB As ADODB.Connection
'Dim rsE As ADODB.Recordset
'Dim strEQ As String
strEQ = "SELECT eid,ename,snpln,dp,location,acost,currentuser,eqptype FROM eqpt WHERE eqptype='Bldg Equipment'"
Set myDB = New ADODB.Connection
myDB.CursorLocation = adUseClient
myDB.ConnectionString = connHBK
myDB.Open
Set rsE = New ADODB.Recordset
rsE.Open strEQ, myDB, adOpenStatic, adLockOptimistic
Set Me.Recordset = rsE
If rsE.RecordCount > 0 Then
rsE.MoveFirst
While Not rsE.EOF
Me![eid].Value = rsE("eid")
Me![ename].Value = rsE("ename")
Me![snpln].Value = rsE("snpln")
Me![dp].Value = rsE("dp")
Me![location].Value = rsE("location")
Me![acost].Value = rsE("acost")
Me![currentuser].Value = rsE("currentuser")
rsE.MoveNext
Wend
End If
rsE.Close
Set rsE = Nothing
myDB.Close
Set myDB = Nothing
Me![Label18].Caption = "Serial No"
ElseIf Forms![fEMain]![lblTicker].Caption = "C" Then
'Dim myDB As ADODB.Connection
'Dim rsE As ADODB.Recordset
'Dim strEQ As String
strEQ = "SELECT eid,ename,snpln,dp,location,acost,currentuser,eqptype FROM eqpt WHERE eqptype='Computer'"
Set myDB = New ADODB.Connection
myDB.CursorLocation = adUseClient
myDB.ConnectionString = connHBK
myDB.Open
Set rsE = New ADODB.Recordset
rsE.Open strEQ, myDB, adOpenStatic, adLockOptimistic
Set Me.Recordset = rsE
If rsE.RecordCount > 0 Then
rsE.MoveFirst
While Not rsE.EOF
Me![eid].Value = rsE("eid")
Me![ename].Value = rsE("ename")
Me![snpln].Value = rsE("snpln")
Me![dp].Value = rsE("dp")
Me![location].Value = rsE("location")
Me![acost].Value = rsE("acost")
Me![currentuser].Value = rsE("currentuser")
rsE.MoveNext
Wend
End If
rsE.Close
Set rsE = Nothing
myDB.Close
Set myDB = Nothing
Me![Label18].Caption = "Serial No"
End If
End If
End Sub