I apologize up front, this will be a long post...
I am working on creating a form for our office which tracks flights that are requesting to land on our parking apron. I am to a point where I want to compile all of the input data into shorthand for a Mission Remarks box so that I can simply use that box when I run reports.
BACKGROUND INFO:
Every flight that is requested can have one or multiple of the following options:
-Customs Only (check box)
-Fuel Requested (check box)
-Offload Cargo (check box)
--Rolling Stock (number field)
--Pallets (number field)
--Pallet Trains (text field)
-Onload Cargo (check box)
--Rolling Stock (number field)
--Pallets (number field)
--Pallet Trains (text field)
-Throughload Cargo (check box)
-Explosives (check box)
-Offload Passengers (check box followed by a number field--two separate fields in my table)
-Onload Passengers (check box followed by a number field--two separate fields in my table)
-Throughload Passengers (check box)
-VIP Onload (check box followed by a number field--two separate fields in my table)
-VIP Offload (check box followed by a number field--two separate fields in my table)
-VIP Throughload (check box)
What I would like is when a user clicks the "Update Mission Remarks" button I've created, for all of the above information to get put into a memo field. With the following conditions:
If say the Offload Cargo box is checked (TRUE) then look to the Rolling Stock Pallet fields to see if they have numbers there as well as the Pallet trains...if they do, then I would like to reference them in shorthand on my Mission Remarks box...that's the easy part (which I've done in past attempts), here's where I'm having trouble...if the Offload Cargo box is checked (TRUE) and all three of the fields are empty, I would like it to say "UNKNOWN CARGO"
I've used the following VBA code to mixed results:
I appreciate any iput you could give me. I'd be willing to upload a sanitized copy of the form that i'm creating if that would help.
Thanks in advance!
I am working on creating a form for our office which tracks flights that are requesting to land on our parking apron. I am to a point where I want to compile all of the input data into shorthand for a Mission Remarks box so that I can simply use that box when I run reports.
BACKGROUND INFO:
Every flight that is requested can have one or multiple of the following options:
-Customs Only (check box)
-Fuel Requested (check box)
-Offload Cargo (check box)
--Rolling Stock (number field)
--Pallets (number field)
--Pallet Trains (text field)
-Onload Cargo (check box)
--Rolling Stock (number field)
--Pallets (number field)
--Pallet Trains (text field)
-Throughload Cargo (check box)
-Explosives (check box)
-Offload Passengers (check box followed by a number field--two separate fields in my table)
-Onload Passengers (check box followed by a number field--two separate fields in my table)
-Throughload Passengers (check box)
-VIP Onload (check box followed by a number field--two separate fields in my table)
-VIP Offload (check box followed by a number field--two separate fields in my table)
-VIP Throughload (check box)
What I would like is when a user clicks the "Update Mission Remarks" button I've created, for all of the above information to get put into a memo field. With the following conditions:
If say the Offload Cargo box is checked (TRUE) then look to the Rolling Stock Pallet fields to see if they have numbers there as well as the Pallet trains...if they do, then I would like to reference them in shorthand on my Mission Remarks box...that's the easy part (which I've done in past attempts), here's where I'm having trouble...if the Offload Cargo box is checked (TRUE) and all three of the fields are empty, I would like it to say "UNKNOWN CARGO"
I've used the following VBA code to mixed results:
Code:
Private Sub UpdateMissionRemarks_Click()
Dim rmk As String: rmk = ""
Dim Fuel As String: Fuel = ""
Dim custonly As String: custonly = ""
Dim cgooff As String: cgooff = ""
Dim cgoon As String: cgoon = ""
Dim cgothru As String: cgothru = ""
Dim cgoexp As String: cgoexp = ""
Dim paxoff As String: paxoff = ""
Dim paxon As String: paxon = ""
Dim paxthru As String: paxthru = ""
Dim dvon As String: dvon = ""
Dim dvoff As String: dvoff = ""
Dim dvthru As String: dvthru = ""
If Me.Fuel = True Then
Fuel = "FUEL"
Else
End If
If Me.CustomsOnly = True Then
custonly = "CUSTOMS ONLY"
Else
End If
If Me.CargoOffloadBDSC = True Then
If (IsNull(Me.RollingOff) = True) Then
cgooff = Me.PalletOff & " $" & " " & Me.PalletTrainOff
If (IsNull(Me.PalletOff) = True) Then
cgooff = Me.RollingOff & " RSS" & " " & Me.PalletTrainOff
If (IsNull(Me.PalletTrainOff) = True) Then
cgooff = Me.RollingOff & " RSS" & " " & Me.PalletOff & " $"
If (IsNull(Me.RollingOff) = True) + (IsNull(Me.PalletOff) = True) Then
cgooff = Me.PalletTrainOff
If (IsNull(Me.RollingOff & Me.PalletOff & Me.PalletTrainOff) = True) Then
cgooff = "UNKNOWN CARGO"
Else
End If
Else
End If
Else
End If
Else
End If
Else
cgooff = (Me.RollingOff & " RSS") & " " & (Me.PalletOff & " $") & " " & Me.PalletTrainOff
End If
Else
End If
If Me.CargoOnloadBDSC = True Then
cgoon = Nz(Me.RollingOn) & " RSS" & Nz(Me.PalletOn) & " $" & Nz(Me.PalletTrainOn)
Else
End If
If Me.CargoThru = True Then
cgothru = "CARGO THRU"
Else
End If
If Me.Explosives = True Then
cgoexp = Me.HighestClass & Me.ExplosivesOnOff & " (" & Me.NEW & ")"
Else
End If
If Me.PassengersOnloadBDSC = True Then
paxon = Nz(Me.PassengersOnQuantity) & " Pax"
Else
End If
If Me.PassengersOffloadBDSC = True Then
paxoff = Nz(Me.PassengersOffQuantity) & " Pax"
Else
End If
If Me.PassengersThruload = True Then
paxthru = "PAX THRU"
Else
End If
If Me.VIP_DV = True Then
If Me.VIP_DVOff = True Then
dvoff = Me.DVTotalNumber & " DV"
Else
End If
If Me.VIP_DVOn = True Then
dvon = Me.DVQtyOn & " DV"
Else
End If
If Me.VIP_DVThru = True Then
dvthru = "DV THRU"
Else
End If
Else
End If
rmk = custonly & cgooff & " " & cgothru & " " & cgoexp & " " & paxoff & " " & paxthru & " " & dvoff & " " & dvthru & " OFF" & " " & Fuel & _
vbCrLf & cgoon & " " & paxon & " " & dvon & " ON"
Me.CargoRemarks = (rmk)
I appreciate any iput you could give me. I'd be willing to upload a sanitized copy of the form that i'm creating if that would help.
Thanks in advance!