VbzCart/docs/archive/code/VBA/Form frmPackages: Difference between revisions
Jump to navigation
Jump to search
imported>Woozle (form screenshots) |
m (Woozle moved page VbzCart/VbzCart/archive/code/VBA/Form frmPackages to VbzCart/docs/archive/code/VBA/Form frmPackages without leaving a redirect: correct naming (was no way to import directly to this name)) |
||
(3 intermediate revisions by one other user not shown) | |||
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]] | |||
|} | |||
<syntaxhighlight lang=VB> | |||
Option Compare Database | Option Compare Database | ||
Option Explicit | Option Explicit | ||
Line 52: | Line 59: | ||
End With | End With | ||
End Sub | End Sub | ||
</ | </syntaxhighlight> |
Latest revision as of 01:53, 25 February 2024
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