Difference between revisions of "VbzCart/archive/code/VBA/Form frmPackages"
Jump to navigation
Jump to search
(form screenshots) |
(form with data; rearranged other images) |
||
| Line 1: | Line 1: | ||
| − | [[File:vbzcart-MSAccess-frmPackages.png|400px| | + | {| |
| − | [[File:vbzcart-MSAccess-sfrmPackages.png| | + | |- |
| + | | | ||
| + | [[File:vbzcart-MSAccess-frmPackages-running.png|400px]] | ||
| + | | | ||
| + | [[File:vbzcart-MSAccess-frmPackages.png|thumb]] | ||
| + | [[File:vbzcart-MSAccess-sfrmPackages.png|thumb]] | ||
| + | |} | ||
| + | <VB> | ||
Option Compare Database | Option Compare Database | ||
Option Explicit | Option Explicit | ||
Revision as of 14:15, 8 May 2014
<VB> Option Compare Database Option Explicit Dim intPkg As Long Dim objPkg As clsPackage Public Sub AlertPackageChanged(iPackage As Long)
intPkg = iPackage UpdateStatus
End Sub Private Property Get PackageExists() As Boolean
If intPkg = 0 Then
PackageExists = False
Else
Set objPkg = clsPackages.Item(intPkg)
PackageExists = Not (objPkg Is Nothing)
End If
End Property Private Sub UpdateStatus()
Dim isPkg As Boolean
isPkg = PackageExists
Me.txtPkgCode.SetFocus ' so we can disable buttons without checking which one has the focus
Me.btnOrder.Enabled = isPkg
Me.btnPkg.Enabled = isPkg
If isPkg Then
Me.btnShpmt.Enabled = objPkg.ShipmentExists
Me.txtPkgCode = objPkg.Code
Else
Me.btnShpmt.Enabled = False
Me.txtPkgCode = ""
End If
End Sub Private Sub btnOrder_Click()
UpdateStatus If PackageExists Then objPkg.Order.View
End Sub Private Sub btnPkg_Click()
UpdateStatus If PackageExists Then objPkg.Edit
End Sub Private Sub Form_Activate()
UpdateStatus
End Sub Private Sub Form_Load()
UpdateStatus
End Sub Private Sub Form_Resize()
With Me.sfrmPackages
.Width = Me.InsideWidth - .Left
.Height = Me.InsideHeight - .Top
End With
End Sub </VB>
