Content Supported by Sourcelens Consulting
Attribute VB_Name = "modDEGlobal"
Option Explicit
Private ShapeCmd
Public Sub StoreShape()
On Error GoTo StoreShapeErr
' Store the Shape command in the variable for later reuse.
ShapeCmd = deNwind.rsCustomers.Source
Exit Sub
StoreShapeErr:
MsgBox Err.Number & ": " & Err.Description
End
End Sub
Public Sub ReShape()
' This procedure resets the Source property of the
' topmost Command object (rsCustomers) to the
' original Shape command.
' Temporarily store the Connection object for use
' when reopening the recordset.
On Error GoTo ReshapeErr
Dim cnTemp As Connection
Set cnTemp = deNwind.rsCustomers.ActiveConnection
If cnTemp.State = adStateOpen Then cnTemp.Close
With deNwind.rsCustomers
If .State = adStateOpen Then .Close
.Source = ShapeCmd
cnTemp.CursorLocation = adUseClient
cnTemp.Open
.Open , cnTemp, adOpenStatic, adLockOptimistic
End With
Exit Sub
ReshapeErr:
MsgBox Err.Number, Err.Description
End
End Sub
Public Sub WalkTheCommandShape(rsX As Recordset)
Dim f As Field
Dim rsOrders As Recordset
Dim rsOrderDetails As Recordset
Dim rsProducts As Recordset
Set rsOrders = rsX.Fields("Orders").Value
For Each f In rsOrders.Fields
Debug.Print f.Name
Next f
Set rsOrderDetails = rsOrders.Fields("OrderDetails").Value
For Each f In rsOrderDetails.Fields
Debug.Print f.Name
Next f
Set rsProducts = _
rsOrderDetails.Fields("Products").Value
For Each f In rsProducts.Fields
Debug.Print f.Name
Next f
End Sub
Public Sub FormsUnload()
' This function simply closes any extra forms, allowing
' only the main form and the last opened form to be
' shown.
If Forms.Count > 2 Then
Unload Forms(1)
End If
End Sub