Difference between revisions of "VbzCart/archive/code/VBA/Form frmPackages"
Jump to navigation
Jump to search
m (Woozle moved page VbzCart/code/VBA/Form frmPackages to VbzCart/archive/code/VBA/Form frmPackages) |
m |
||
Line 7: | Line 7: | ||
[[File:vbzcart-MSAccess-sfrmPackages.png|thumb]] | [[File:vbzcart-MSAccess-sfrmPackages.png|thumb]] | ||
|} | |} | ||
− | <VB> | + | <syntaxhighlight lang=VB> |
Option Compare Database | Option Compare Database | ||
Option Explicit | Option Explicit | ||
Line 59: | Line 59: | ||
End With | End With | ||
End Sub | End Sub | ||
− | </ | + | </syntaxhighlight> |
Latest revision as of 12:52, 14 October 2022
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