private sub Form_Load( )
General information
Full name frmSalesOrder.Form_Load Access private Overload of Purpose Set the security of this form and loads data from the database. Prototype private sub Form_Load( ) History NOVALYS - 2001/10/20 - Creation
Local variables
db Connection
Source code
Private Sub Form_Load()
'*********************************************************
' Purpose : Set the security of this form and loads data from the database.
' Subject : INTERNAL
' History : NOVALYS - 2001/10/20 - Creation
'*********************************************************
Dim db As Connection // The security Database connection
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=MSDataShape;Data PROVIDER=MSDASQL;dsn=Pack Secu 7;uid=dba;pwd=sql;"
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "SHAPE {select id,cust_id,order_date,region,sales_rep from sales_order} AS ParentCMD APPEND ({select id,line_id,prod_id,quantity,ship_date from sales_order_items Order by line_id } AS ChildCMD RELATE id TO id) AS ChildCMD", db, adOpenStatic, adLockOptimistic
Dim oText As TextBox
'Link the data with the datasource
For Each oText In Me.txtFields
Set oText.DataSource = adoPrimaryRS
Next
Set grdDataGrid.DataSource = adoPrimaryRS( "ChildCMD").UnderlyingValue
mbDataChanged = False
End Sub
Referenced classes
Full name Connection
private sub Form_Resize( )
General information
Full name frmSalesOrder.Form_Resize Access private Overload of Purpose Moves the controls according to the form size. Comment If you add a new control in this form you must add the code the position of this control. Prototype private sub Form_Resize( ) History NOVALYS - 2001/10/20 - Creation
Source code
Private Sub Form_Resize()
'*********************************************************
' Purpose : Moves the controls according to the form size.
' Comment : If you add a new control in this form you must add the code the position of this control.
' Subject : GUI
' History : NOVALYS - 2001/10/20 - Creation
'*********************************************************
On Error Resume Next
'Resize the datagrid
grdDataGrid.Width = Me.ScaleWidth
grdDataGrid.Height = Me.ScaleHeight - grdDataGrid.Top - 30 - picButtons.Height - picStatBox.Height
lblStatus.Width = Me.Width - 1500
cmdNext.Left = lblStatus.Width + 700
cmdLast.Left = cmdNext.Left + 340
End Sub
Referenced classes
Full name cmdLast cmdNext lblStatus picStatBox picButtons frmSalesOrder grdDataGrid
private sub Form_KeyDown( KeyCode as Integer , Shift as Integer )
General information
Full name frmSalesOrder.Form_KeyDown Access private Overload of Purpose Form-Level Keyboard Handlers. Parameter KeyCode : The key code the key that was pressed. Shift : An integer that corresponds to the state of the SHIFT, CTRL, and ALT keys at the time of the event. Prototype private sub Form_KeyDown( KeyCode as Integer , Shift as Integer ) History NOVALYS - 2001/10/20 - Creation
Parameters
Shift Integer KeyCode Integer
Source code
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'*********************************************************
' Purpose : Form-Level Keyboard Handlers.
' Comment :
' Parameter : KeyCode : The key code the key that was pressed.
' Shift : An integer that corresponds to the state of the SHIFT, CTRL, and ALT keys at the time of the event.
' Subject : GUI
' History : NOVALYS - 2001/10/20 - Creation
'*********************************************************
If mbEditFlag Or mbAddNewFlag Then Exit Sub
Select Case KeyCode
Case vbKeyEscape
cmdClose_Click
Case vbKeyEnd
cmdLast_Click
Case vbKeyHome
cmdFirst_Click
Case vbKeyUp, vbKeyPageUp
If Shift = vbCtrlMask Then
cmdFirst_Click
Else
cmdPrevious_Click
End If
Case vbKeyDown, vbKeyPageDown
If Shift = vbCtrlMask Then
cmdLast_Click
Else
cmdNext_Click
End If
End Select
End Sub
Functions and events referenced
Full name Owners cmdNext.cmdNext_Click cmdNext cmdPrevious.cmdPrevious_Click cmdPrevious cmdFirst.cmdFirst_Click cmdFirst cmdLast.cmdLast_Click cmdLast cmdClose.cmdClose_Click cmdClose
Referenced properties
Full name Scope frmSalesOrder.Form_KeyDown.Shift parameter frmSalesOrder.Form_KeyDown.KeyCode parameter frmSalesOrder.mbAddNewFlag attribute frmSalesOrder.mbEditFlag attribute
private sub Form_Unload( Cancel as Integer )
General information
Full name frmSalesOrder.Form_Unload Access private Overload of
Parameters
Cancel Integer
Source code
Private Sub Form_Unload(Cancel As Integer)
Screen.MousePointer = vbDefault
End Sub
Document created on Wednesday 20 March 2002 at 09:57 by Visual Expert